From 7cd05e520ac1bc4dd4b6cb4e92c3f8a2d7236a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 10 Jan 2018 17:24:28 +0100 Subject: [PATCH] [apps] Graph: avoid reloading when highlighting the area under curve (which does change in the Graph app) --- apps/graph/graph/graph_view.cpp | 1 + apps/graph/graph/graph_view.h | 5 +++++ apps/shared/function_graph_view.h | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/graph/graph/graph_view.cpp b/apps/graph/graph/graph_view.cpp index 071166259..21cdac509 100644 --- a/apps/graph/graph/graph_view.cpp +++ b/apps/graph/graph/graph_view.cpp @@ -1,4 +1,5 @@ #include "graph_view.h" +#include using namespace Shared; diff --git a/apps/graph/graph/graph_view.h b/apps/graph/graph/graph_view.h index 9d586eeff..294bb2b3f 100644 --- a/apps/graph/graph/graph_view.h +++ b/apps/graph/graph/graph_view.h @@ -14,6 +14,11 @@ public: void reload() override; void drawRect(KDContext * ctx, KDRect rect) const override; void drawTangent(bool tangent) { m_tangent = tangent; } + /* We override setAreaHighlightColor to make it reload nothing as the + * highlightColor and the non-highlightColor are identical in the graph view + * of the application graph. We thereby avoid to uselessly reload some part + * of the graph where the area under the curve is colored. */ + void setAreaHighlightColor(bool highlightColor) override {}; private: CartesianFunctionStore * m_functionStore; bool m_tangent; diff --git a/apps/shared/function_graph_view.h b/apps/shared/function_graph_view.h index 5dceea693..4bc048af2 100644 --- a/apps/shared/function_graph_view.h +++ b/apps/shared/function_graph_view.h @@ -19,8 +19,9 @@ public: void selectFunction(Function * function); void setVerticalCursor(bool verticalCursor); void setAreaHighlight(float start, float end); - void setAreaHighlightColor(bool highlightColor); + virtual void setAreaHighlightColor(bool highlightColor); protected: + void reloadBetweenBounds(float start, float end); Function * m_selectedFunction; bool m_verticalCursor; float m_highlightedStart; @@ -28,7 +29,6 @@ protected: bool m_shouldColorHighlighted; private: KDSize cursorSize() override; - void reloadBetweenBounds(float start, float end); char * label(Axis axis, int index) const override; char m_xLabels[k_maxNumberOfXLabels][Poincare::PrintFloat::bufferSizeForFloatsWithPrecision(Constant::ShortNumberOfSignificantDigits)]; char m_yLabels[k_maxNumberOfYLabels][Poincare::PrintFloat::bufferSizeForFloatsWithPrecision(Constant::ShortNumberOfSignificantDigits)];