Bladeren bron

Mixer paint (190qh's peak values and correlation bars, on by default now): over the cached picture their boxes are not filled again (the picture holds them), and a strip saves the Graphics state only when a pinned dock block covers part of it; --paintbench LYNX_PAINTBENCH_MIXER_EXTRAS=0|1 for an A/B (big200 Mixer +3.2 % -> +1.4 % vs 0.1.31.1, the extras themselves +0.4 / +0.7 / -0.3 %)

Ka1-S 1 week geleden
bovenliggende
commit
dbe49d5102
3 gewijzigde bestanden met toevoegingen van 41 en 21 verwijderingen
  1. 11 0
      src/Main.cpp
  2. 27 19
      src/ui/MixerComponent.cpp
  3. 3 2
      src/ui/MixerComponent.h

+ 11 - 0
src/Main.cpp

@@ -29588,6 +29588,17 @@ private:
         juce::String text;
         text << "project: " << project.getFullPathName() << "\nLYNX " << getApplicationVersion() << ", " << juce::SystemStats::getCpuModel()
              << ", window " << ui.getWidth() << "x" << ui.getHeight() << "\n";
+        // LYNX_PAINTBENCH_MIXER_EXTRAS=0|1 (rollup 0.1.32 step 2): round 190qh's peak values and correlation bars off / on
+        // (on by default since 0.1.32), for an A/B of their paint cost
+        if (const auto extras = juce::SystemStats::getEnvironmentVariable ("LYNX_PAINTBENCH_MIXER_EXTRAS", {}); extras.isNotEmpty())
+        {
+            if (lynx::mixeroptions::setShowPeakValues && lynx::mixeroptions::setShowCorrelation)
+            {
+                lynx::mixeroptions::setShowPeakValues (extras.getIntValue() != 0);
+                lynx::mixeroptions::setShowCorrelation (extras.getIntValue() != 0);
+            }
+            text << "mixer peak values / correlation " << (extras.getIntValue() != 0 ? "on" : "off") << " (LYNX_PAINTBENCH_MIXER_EXTRAS)\n";
+        }
         if (project.existsAsFile())
         {
             // (round perfgate190id) the time to open it headless, and the memory after

+ 27 - 19
src/ui/MixerComponent.cpp

@@ -4947,13 +4947,14 @@ float loudnessBarPosition (float lufs) noexcept
 constexpr int loudnessRowsTop = 24, loudnessRowHeight = 16;
 } // namespace
 
-void MixerStrips::paintCorrelation (juce::Graphics& g, int t) const
+void MixerStrips::paintCorrelation (juce::Graphics& g, int t, bool overPicture) const
 {
     using namespace theme;
     const auto area = correlationArea (t);
     if (area.isEmpty())
         return;
-    theme::fillRoundRect (g, area.toFloat(), 1.5f, colour::bg0);
+    if (! overPicture)
+        theme::fillRoundRect (g, area.toFloat(), 1.5f, colour::bg0);
     const auto mid = (float) area.getCentreX();
     const auto half = (float) area.getWidth() * 0.5f - 1.0f;
     const auto v = juce::jlimit (-1.0f, 1.0f, shownCorrelation (t));
@@ -4968,13 +4969,14 @@ void MixerStrips::paintCorrelation (juce::Graphics& g, int t) const
     g.fillRect (juce::Rectangle<float> (mid - 0.5f, (float) area.getY() - 1.0f, 1.0f, (float) area.getHeight() + 2.0f));
 }
 
-void MixerStrips::paintPeakValue (juce::Graphics& g, int t) const
+void MixerStrips::paintPeakValue (juce::Graphics& g, int t, bool overPicture) const
 {
     using namespace theme;
     const auto area = peakValueArea (t);
     if (area.isEmpty())
         return;
-    theme::fillRoundRect (g, area.toFloat(), 2.0f, colour::bg0);
+    if (! overPicture)
+        theme::fillRoundRect (g, area.toFloat(), 2.0f, colour::bg0);
     const auto peak = heldPeak (t);
     g.setFont (font (9.0f, true));
     if (peak <= 1.0e-5f)
@@ -5395,26 +5397,32 @@ void MixerStrips::paintMeterLevels (juce::Graphics& g) const
         const auto bars = nameBars (t);
         const auto meterShown = meters.intersects (clip) && g.clipRegionIntersects (meters);
         const auto barsShown = ! bars.isEmpty() && bars.intersects (clip) && g.clipRegionIntersects (bars);
-        // round 190qh: the correlation bar and the peak value box over the picture
+        // round 190qh: the correlation bar and the peak value box over the picture (their boxes are in it)
         const auto corr = correlationArea (t), peakBox = peakValueArea (t);
-        const auto extrasShown = (! corr.isEmpty() && g.clipRegionIntersects (corr)) || (! peakBox.isEmpty() && g.clipRegionIntersects (peakBox));
-        if (extrasShown)
-        {
-            const juce::Graphics::ScopedSaveState state (g);
-            if (dockOf (t) == MixerDock::middle)
-                for (const auto& r : pinned)
-                    g.excludeClipRegion (r);
-            if (! corr.isEmpty())
-                paintCorrelation (g, t);
-            if (! peakBox.isEmpty())
-                paintPeakValue (g, t);
-        }
-        if (! meterShown && ! barsShown)
+        const auto corrShown = ! corr.isEmpty() && g.clipRegionIntersects (corr);
+        const auto peakShown = ! peakBox.isEmpty() && g.clipRegionIntersects (peakBox);
+        if (! meterShown && ! barsShown && ! corrShown && ! peakShown)
             continue;
-        const juce::Graphics::ScopedSaveState state (g);
+        // rollup 0.1.32 step 2 (190qh's extras on by default): one saved state per strip, and only for a strip that a pinned
+        // dock block covers part of (the others draw straight: nothing to exclude)
+        auto covered = false;
         if (dockOf (t) == MixerDock::middle)
+        {
+            const auto column = meters.getUnion (bars).getUnion (corr).getUnion (peakBox);
+            for (const auto& r : pinned)
+                covered = covered || r.intersects (column);
+        }
+        std::optional<juce::Graphics::ScopedSaveState> state;
+        if (covered)
+        {
+            state.emplace (g);
             for (const auto& r : pinned)
                 g.excludeClipRegion (r);
+        }
+        if (corrShown)
+            paintCorrelation (g, t, true);
+        if (peakShown)
+            paintPeakValue (g, t, true);
         if (meterShown && meterWaveforms) // round 190lr (DF-60): FL's Waveforms view instead of the two bars
             paintMeterWave (g, t, meters.withWidth (2 * sp.meterWidth + 2));
         else if (meterShown)

+ 3 - 2
src/ui/MixerComponent.h

@@ -559,8 +559,9 @@ private:
     std::map<int, InputMonitor> monitorBefore; // (round 190qh) the mode each insert had before "Input monitoring on"
     juce::Rectangle<int> peakValueArea (int track) const;
     juce::Rectangle<int> correlationArea (int track) const;
-    void paintPeakValue (juce::Graphics& g, int track) const;
-    void paintCorrelation (juce::Graphics& g, int track) const;
+    // `overPicture`: drawn over the cached picture, which holds the box already (rollup 0.1.32 step 2: no second fill)
+    void paintPeakValue (juce::Graphics& g, int track, bool overPicture = false) const;
+    void paintCorrelation (juce::Graphics& g, int track, bool overPicture = false) const;
     void advanceExtras (float elapsedMs, juce::Rectangle<int>& dirty, bool showing);
     std::vector<float> inputLevels;       // per track: input level (decaying)
     // round 190lr (DF-60): the waveform view's history, one row per 1/70 s: waveRing[row * meters + meter] (meter = track