From 2d5c2e66c3b005c87d36b636cb7fcf76a0ffcf37 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Sat, 22 Oct 2022 14:44:54 -0400 Subject: [PATCH] Scale Waveshaper Tearout properly Waveshaper tearout needed transform-dop correction to allow it to draw int he right space. Closes #6635 --- src/surge-xt/gui/overlays/WaveShaperAnalysis.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/surge-xt/gui/overlays/WaveShaperAnalysis.cpp b/src/surge-xt/gui/overlays/WaveShaperAnalysis.cpp index bad378e4e2d..c3b36afd417 100644 --- a/src/surge-xt/gui/overlays/WaveShaperAnalysis.cpp +++ b/src/surge-xt/gui/overlays/WaveShaperAnalysis.cpp @@ -30,6 +30,10 @@ void WaveShaperAnalysis::resized() {} void WaveShaperAnalysis::paint(juce::Graphics &g) { + auto lb = getLocalBounds().transformedBy(getTransform().inverted()); + auto width = lb.getWidth(); + auto height = lb.getHeight(); + if (sliderDrivenCurve.empty() || lastDbValue != getDbValue() || lastPFG != getPFG()) { recalcFromSlider(); @@ -42,10 +46,9 @@ void WaveShaperAnalysis::paint(juce::Graphics &g) auto xf = juce::AffineTransform() .translated(0, -1.0) .scaled(1, -0.5) - .scaled(getWidth(), getHeight()) + .scaled(width, height) .translated(sideOne, 2 + top) - .scaled((getWidth() - sideOne - sideTwo) / getWidth(), - (getHeight() - 4.0 - top) / getHeight()); + .scaled((width - sideOne - sideTwo) / width, (height - 4.0 - top) / height); auto re = juce::Rectangle{0, -1, 1, 2}.transformedBy(xf); @@ -140,7 +143,7 @@ void WaveShaperAnalysis::paint(juce::Graphics &g) g.setColour(skin->getColor(Colors::MSEGEditor::Grid::Primary)); g.drawRect(re); - auto txtr = getLocalBounds().withHeight(top - 6); + auto txtr = lb.withHeight(top - 6); std::ostringstream title; title << sst::waveshapers::wst_names[(int)wstype];