[apps/graph/graph] When redrawing the curve, slightly exceed the rect to

ensure the continuity of the curve

Change-Id: I7dcdc53dc14819b7bf1327a7ba98d459b3bc9c63
This commit is contained in:
Émilie Feral
2016-12-20 13:58:26 +01:00
parent ba67ef4a2e
commit 4e1bd2b477

View File

@@ -131,13 +131,14 @@ const uint8_t stampMask[stampSize+1][stampSize+1] = {
constexpr static int k_maxNumberOfIterations = 10;
constexpr static int k_resolution = 320.0f;
constexpr static int k_externRectMargin = 1;
void CurveView::drawCurve(void * curve, KDColor color, KDContext * ctx, KDRect rect, bool colorUnderCurve, float colorLowerBound, float colorUpperBound, bool continuously) const {
float xMin = min(Axis::Horizontal);
float xMax = max(Axis::Horizontal);
float xStep = (xMax-xMin)/k_resolution;
float rectMin = pixelToFloat(Axis::Horizontal, rect.left());
float rectMax = pixelToFloat(Axis::Horizontal, rect.right());
float rectMin = pixelToFloat(Axis::Horizontal, rect.left() - k_externRectMargin);
float rectMax = pixelToFloat(Axis::Horizontal, rect.right() + k_externRectMargin);
for (float x = rectMin; x < rectMax; x += xStep) {
float y = evaluateCurveAtAbscissa(curve, x);
float pxf = floatToPixel(Axis::Horizontal, x);