[apps/graph] Activated caching for graph drawing

Added a default argument to CurveView::drawCurve : a function to initiate the
memoization of continuous functions. The function is implemented in
ContinuousFunctionCache and provided by GraphView. This should be invisible
to other types of curves that rely on CurveView::drawCurve.

Change-Id: I59aa55d67154b6d4bf9614b7ed87c48408773d86
This commit is contained in:
Gabriel Ozouf
2020-06-09 14:10:01 +02:00
committed by Émilie Feral
parent c70b545ba1
commit 95fef86ec0
3 changed files with 12 additions and 7 deletions

View File

@@ -62,7 +62,8 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
ContinuousFunction * f = (ContinuousFunction *)model;
Poincare::Context * c = (Poincare::Context *)context;
return f->evaluateXYAtParameter(t, c);
});
},
&ContinuousFunctionCache::PrepareCache);
/* Draw tangent */
if (m_tangent && record == m_selectedRecord) {
float tangentParameterA = f->approximateDerivative(m_curveViewCursor->x(), context());
@@ -83,7 +84,9 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
ContinuousFunction * f = (ContinuousFunction *)model;
Poincare::Context * c = (Poincare::Context *)context;
return f->evaluateXYAtParameter(t, c);
}, f.operator->(), context(), false, f->color());
}, f.operator->(), context(), false, f->color(),
true, false, 0.0f, 0.0f, /* drawCurve's default arguments */
&ContinuousFunctionCache::PrepareCache);
}
}