Skip to content

Commit

Permalink
Scale Waveshaper Tearout properly
Browse files Browse the repository at this point in the history
Waveshaper tearout needed transform-dop correction to allow it
to draw int he right space.

Closes surge-synthesizer#6635
  • Loading branch information
baconpaul committed Oct 22, 2022
1 parent 8429811 commit 2d5c2e6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/surge-xt/gui/overlays/WaveShaperAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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<float>{0, -1, 1, 2}.transformedBy(xf);

Expand Down Expand Up @@ -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];

Expand Down

0 comments on commit 2d5c2e6

Please sign in to comment.