From 4b9517a148bcd6f47cc2f20a83355093811cc04b Mon Sep 17 00:00:00 2001 From: Vasile Vilvoiu Date: Thu, 21 Oct 2021 23:12:06 +0300 Subject: Renderer does not cache colromap and valuemap. * Renderer build colormap from configuration. * Renderer builds (temporary) valuemap from configuration. * LiveOutput no longer needs cmap/vmap parameters. --- src/live.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/live.cpp') diff --git a/src/live.cpp b/src/live.cpp index 0120bd7..a59f828 100644 --- a/src/live.cpp +++ b/src/live.cpp @@ -9,8 +9,10 @@ #include #include -LiveOutput::LiveOutput(const Configuration& conf, const ColorMap& cmap, const ValueMap& vmap) - : configuration_(conf), renderer_(conf.GetForLive(), cmap, vmap, conf.GetCount()) +LiveOutput::LiveOutput(const Configuration& conf) + : width_(conf.GetWidth()) + , is_horizontal_(conf.IsHorizontal()) + , renderer_(conf.GetForLive(), conf.GetCount()) { auto width = conf.IsHorizontal() ? renderer_.GetHeight() : renderer_.GetWidth(); auto height = conf.IsHorizontal() ? renderer_.GetWidth() : renderer_.GetHeight(); @@ -34,7 +36,7 @@ std::vector LiveOutput::AddWindow(const RealWindow& win_values) { auto window = this->renderer_.RenderLiveFFT(win_values); - std::size_t wlen_bytes = this->configuration_.GetWidth() * 4; + std::size_t wlen_bytes = this->width_ * 4; if (window.size() != wlen_bytes) { throw std::runtime_error("input window size differs from live window size"); } @@ -74,7 +76,7 @@ LiveOutput::Render() /* draw renderer output to window */ sf::Texture canvas_texture = this->renderer_.GetCanvas(); sf::Sprite canvas_sprite(canvas_texture); - if (this->configuration_.IsHorizontal()) { + if (this->is_horizontal_) { canvas_sprite.setRotation(-90.0f); canvas_sprite.setPosition(0.0f, canvas_texture.getSize().x); } -- cgit v1.2.3