From 8a7566426422b95a557073a8c10a754e1188ffde Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Sat, 27 Mar 2021 23:31:18 +0100 Subject: [PATCH] Preventing display glitch from invalid scaling of view --- GeometryView.cpp | 5 +++++ LayerView.cpp | 5 +++++ MixingView.cpp | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/GeometryView.cpp b/GeometryView.cpp index 493cb5a..0145419 100644 --- a/GeometryView.cpp +++ b/GeometryView.cpp @@ -144,6 +144,11 @@ void GeometryView::update(float dt) } output_surface_->setTextureIndex( output->texture() ); } + + // prevent invalid scaling + float s = CLAMP(scene.root()->scale_.x, GEOMETRY_MIN_SCALE, GEOMETRY_MAX_SCALE); + scene.root()->scale_.x = s; + scene.root()->scale_.y = s; } // the current view is the geometry view diff --git a/LayerView.cpp b/LayerView.cpp index 40f5cba..7c2d91f 100644 --- a/LayerView.cpp +++ b/LayerView.cpp @@ -169,6 +169,11 @@ void LayerView::update(float dt) persp_left_->translation_.x = -aspect_ratio; persp_right_->translation_.x = aspect_ratio + 0.06; } + + // prevent invalid scaling + float s = CLAMP(scene.root()->scale_.x, LAYER_MIN_SCALE, LAYER_MAX_SCALE); + scene.root()->scale_.x = s; + scene.root()->scale_.y = s; } if (Mixer::manager().view() == this ) diff --git a/MixingView.cpp b/MixingView.cpp index 476927d..5e5534d 100644 --- a/MixingView.cpp +++ b/MixingView.cpp @@ -280,6 +280,10 @@ void MixingView::update(float dt) f = 1.f - f; mixingCircle_->shader()->color = glm::vec4(f, f, f, 1.f); + // prevent invalid scaling + float s = CLAMP(scene.root()->scale_.x, MIXING_MIN_SCALE, MIXING_MAX_SCALE); + scene.root()->scale_.x = s; + scene.root()->scale_.y = s; } // the current view is the mixing view