[apps/shared/curve_view] drawCurve does not call straightJoinDots anymore

Remove the "bool continuously" parameter of the method drawCurve that allowed
to bypass the call to jointDots and call straightJoinDots directly
instead.
This commit is contained in:
Ruben Dashyan
2019-06-18 17:25:12 +02:00
committed by EmilieNumworks
parent 585b77c38f
commit 9ab55e6a04
3 changed files with 5 additions and 11 deletions

View File

@@ -25,7 +25,7 @@ void LawCurveView::drawRect(KDContext * ctx, KDRect rect) const {
return;
}
if (m_law->isContinuous()) {
drawCurve(ctx, rect, EvaluateAtAbscissa, m_law, nullptr, Palette::YellowDark, true, lowerBound, upperBound, true);
drawCurve(ctx, rect, EvaluateAtAbscissa, m_law, nullptr, Palette::YellowDark, true, lowerBound, upperBound);
} else {
drawHistogram(ctx, rect, EvaluateAtAbscissa, m_law, nullptr, 0, 1, false, Palette::GreyMiddle, Palette::YellowDark, lowerBound, upperBound+0.5f);
}
@@ -51,7 +51,7 @@ void LawCurveView::drawStandardNormal(KDContext * ctx, KDRect rect, float colorL
// Draw a centered reduced normal curve
NormalLaw n;
constCastedThis->setCurveViewRange(&n);
drawCurve(ctx, rect, EvaluateAtAbscissa, &n, nullptr, Palette::YellowDark, true, colorLowerBound, colorUpperBound, true);
drawCurve(ctx, rect, EvaluateAtAbscissa, &n, nullptr, Palette::YellowDark, true, colorLowerBound, colorUpperBound);
// Put back the previous curve view range
constCastedThis->setCurveViewRange(previousRange);

View File

@@ -503,7 +503,7 @@ const uint8_t stampMask[stampSize+1][stampSize+1] = {
constexpr static int k_maxNumberOfIterations = 10;
void CurveView::drawCurve(KDContext * ctx, KDRect rect, EvaluateModelWithParameter evaluation, void * model, void * context, KDColor color, bool colorUnderCurve, float colorLowerBound, float colorUpperBound, bool continuously) const {
void CurveView::drawCurve(KDContext * ctx, KDRect rect, EvaluateModelWithParameter evaluation, void * model, void * context, KDColor color, bool colorUnderCurve, float colorLowerBound, float colorUpperBound) const {
const float xStep = pixelWidth();
float rectMin = pixelToFloat(Axis::Horizontal, rect.left() - k_externRectMargin);
float rectMax = pixelToFloat(Axis::Horizontal, rect.right() + k_externRectMargin);
@@ -527,13 +527,7 @@ void CurveView::drawCurve(KDContext * ctx, KDRect rect, EvaluateModelWithParamet
if (x <= rectMin || std::isnan(evaluation(x-xStep, model, context))) {
continue;
}
if (continuously) {
float puf = floatToPixel(Axis::Horizontal, x - xStep);
float pvf = floatToPixel(Axis::Vertical, evaluation(x-xStep, model, context));
straightJoinDots(ctx, rect, puf, pvf, pxf, pyf, color);
} else {
jointDots(ctx, rect, evaluation, model, context, x - xStep, evaluation(x-xStep, model, context), x, y, color, k_maxNumberOfIterations);
}
jointDots(ctx, rect, evaluation, model, context, x - xStep, evaluation(x-xStep, model, context), x, y, color, k_maxNumberOfIterations);
}
}

View File

@@ -63,7 +63,7 @@ protected:
void drawGrid(KDContext * ctx, KDRect rect) const;
void drawAxes(KDContext * ctx, KDRect rect) const;
void drawAxis(KDContext * ctx, KDRect rect, Axis axis) const;
void drawCurve(KDContext * ctx, KDRect rect, EvaluateModelWithParameter evaluation, void * model, void * context, KDColor color, bool colorUnderCurve = false, float colorLowerBound = 0.0f, float colorUpperBound = 0.0f, bool continuously = false) const;
void drawCurve(KDContext * ctx, KDRect rect, EvaluateModelWithParameter evaluation, void * model, void * context, KDColor color, bool colorUnderCurve = false, float colorLowerBound = 0.0f, float colorUpperBound = 0.0f) const;
void drawHistogram(KDContext * ctx, KDRect rect, EvaluateModelWithParameter evaluation, void * model, void * context, float firstBarAbscissa, float barWidth,
bool fillBar, KDColor defaultColor, KDColor highlightColor, float highlightLowerBound = INFINITY, float highlightUpperBound = -INFINITY) const;
void computeLabels(Axis axis);