From 7d2b578c068d4e78250884c576c892b0a609d789 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Thu, 7 Apr 2016 17:33:35 -0300 Subject: LinePlot: less pointers to GDrawings. --- lineplot.cpp | 10 ++++------ lineplot.h | 9 +++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lineplot.cpp b/lineplot.cpp index 0e9e001..35654be 100644 --- a/lineplot.cpp +++ b/lineplot.cpp @@ -60,20 +60,18 @@ void LinePlot::setColorScale(const ColorScale *scale) void LinePlot::relax() { - m_gdFinalPtr.reset(new GraphDrawing); - *m_gdFinalPtr.get() = *m_gdBundlePtr.get(); - m_gdFinalPtr.get()->interpolate(*m_gdPtr.get(), m_relaxation); + m_gdFinal = m_gdBundle; + m_gdFinal.interpolate(*m_gdPtr.get(), m_relaxation); setLinesChanged(true); } void LinePlot::bundle() { - m_gdBundlePtr.reset(new GraphDrawing); - *m_gdBundlePtr.get() = *m_gdPtr.get(); + m_gdBundle = *m_gdPtr.get(); CPUBundling bundling(std::min(width(), height())); - bundling.setInput(m_gdBundlePtr.get()); + bundling.setInput(&m_gdBundle); bundling.niter = m_iterations; bundling.h = m_kernelSize; diff --git a/lineplot.h b/lineplot.h index facb138..422bd2e 100644 --- a/lineplot.h +++ b/lineplot.h @@ -44,9 +44,9 @@ public: void setColorScale(const ColorScale *scale); - const GraphDrawing *graphDrawing() const { return m_gdFinalPtr.get(); } - const std::vector &values() const { return m_values; } - const std::vector &colorScale() const { return m_cmap; } + const GraphDrawing *graphDrawing() const { return &m_gdFinal; } + const std::vector &values() const { return m_values; } + const std::vector &colorScale() const { return m_cmap; } LinearScale scaleX() const { return m_sx; } LinearScale scaleY() const { return m_sy; } @@ -140,7 +140,8 @@ private: // Visuals std::vector m_cmap; LinearScale m_sx, m_sy; - std::unique_ptr m_gdPtr, m_gdBundlePtr, m_gdFinalPtr; + std::unique_ptr m_gdPtr; + GraphDrawing m_gdBundle, m_gdFinal; // Internal state bool m_linesChanged, m_valuesChanged, m_colorScaleChanged; -- cgit v1.2.3