[apps] In CurveView, replace the virtual method evaluateModelWithParameter by a function given as parameter (to be able to call Curve view methods with different implementation of evaluateModelWithParameter)

This commit is contained in:
Émilie Feral
2018-01-08 11:43:55 +01:00
committed by EmilieNumworks
parent ea28475432
commit ef8f5e07c2
12 changed files with 45 additions and 67 deletions

View File

@@ -29,7 +29,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
float windowRange = pixelToFloat(Axis::Horizontal, bounds().width()) - pixelToFloat(Axis::Horizontal, 0);
int step = std::ceil(windowRange/resolution());
for (int x = rectXMin; x < rectXMax; x += step) {
float y = evaluateModelWithParameter(s, x);
float y = s->evaluateAtAbscissa((float)x, context());
if (std::isnan(y)) {
continue;
}
@@ -92,11 +92,6 @@ float GraphView::samplingRatio() const {
return 5.0f;
}
float GraphView::evaluateModelWithParameter(Model * curve, float abscissa) const {
Sequence * s = (Sequence *)curve;
return s->evaluateAtAbscissa(abscissa, context());
}
KDSize GraphView::cursorSize() {
if (m_verticalCursor) {
return KDSize(1, 0);