From 4e1bd2b4774290ed2d27c036d94018a8d0016e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 20 Dec 2016 13:58:26 +0100 Subject: [PATCH] [apps/graph/graph] When redrawing the curve, slightly exceed the rect to ensure the continuity of the curve Change-Id: I7dcdc53dc14819b7bf1327a7ba98d459b3bc9c63 --- apps/curve_view.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/curve_view.cpp b/apps/curve_view.cpp index 76ada169e..4f4ca29a2 100644 --- a/apps/curve_view.cpp +++ b/apps/curve_view.cpp @@ -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);