mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-28 01:59:59 +01:00
[apps/graph][apps/sequence] In values controller, memoize the number of
columns to improve performance Change-Id: Ie3c545d0198a2f23575bd22fdbf56e9c6b8ff2b8
This commit is contained in:
@@ -7,8 +7,8 @@ using namespace Poincare;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
ValuesController::ValuesController(Responder * parentResponder, CartesianFunctionStore * functionStore, Interval * interval, ButtonRowController * header) :
|
||||
Shared::ValuesController(parentResponder, header, I18n::Message::XColumn, &m_intervalParameterController, interval),
|
||||
ValuesController::ValuesController(Responder * parentResponder, CartesianFunctionStore * functionStore, Interval * interval, uint32_t * modelVersion, ButtonRowController * header) :
|
||||
Shared::ValuesController(parentResponder, header, I18n::Message::XColumn, &m_intervalParameterController, interval, modelVersion),
|
||||
m_functionTitleCells{},
|
||||
m_floatCells{},
|
||||
m_functionStore(functionStore),
|
||||
@@ -16,6 +16,7 @@ ValuesController::ValuesController(Responder * parentResponder, CartesianFunctio
|
||||
m_intervalParameterController(this, m_interval),
|
||||
m_derivativeParameterController(this)
|
||||
{
|
||||
updateNumberOfColumns();
|
||||
}
|
||||
|
||||
bool ValuesController::handleEvent(Ion::Events::Event event) {
|
||||
@@ -27,16 +28,6 @@ bool ValuesController::handleEvent(Ion::Events::Event event) {
|
||||
return Shared::ValuesController::handleEvent(event);
|
||||
}
|
||||
|
||||
int ValuesController::numberOfColumns() {
|
||||
int result = 1;
|
||||
for (int i = 0; i < m_functionStore->numberOfActiveFunctions(); i++) {
|
||||
if (m_functionStore->activeFunctionAtIndex(i)->isActive()) {
|
||||
result += 1 + m_functionStore->activeFunctionAtIndex(i)->displayDerivative();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void ValuesController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
|
||||
Shared::ValuesController::willDisplayCellAtLocation(cell, i, j);
|
||||
// The cell is the abscissa title cell:
|
||||
@@ -181,5 +172,15 @@ void ValuesController::unloadView(View * view) {
|
||||
Shared::ValuesController::unloadView(view);
|
||||
}
|
||||
|
||||
void ValuesController::updateNumberOfColumns() {
|
||||
int result = 1;
|
||||
for (int i = 0; i < m_functionStore->numberOfActiveFunctions(); i++) {
|
||||
if (m_functionStore->activeFunctionAtIndex(i)->isActive()) {
|
||||
result += 1 + m_functionStore->activeFunctionAtIndex(i)->displayDerivative();
|
||||
}
|
||||
}
|
||||
m_numberOfColumns = result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user