From 64ff5b4c705b6f9ffa287f231fd2be63d932fb0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 1 Oct 2020 13:39:37 +0200 Subject: [PATCH] [app/shared] CurveView: simplify implementation of pixelLengthToFloatLength (avoid avoidable overflows) --- apps/shared/curve_view.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/shared/curve_view.cpp b/apps/shared/curve_view.cpp index 1890d2455..c655e54e2 100644 --- a/apps/shared/curve_view.cpp +++ b/apps/shared/curve_view.cpp @@ -155,8 +155,7 @@ float CurveView::floatLengthToPixelLength(float dx, float dy) const { } float CurveView::pixelLengthToFloatLength(Axis axis, float f) const { - f = axis == Axis::Vertical ? -f : f; - return pixelToFloat(axis, floatToPixel(axis, 0.0f) + f); + return f*pixelLength(axis); } void CurveView::drawGridLines(KDContext * ctx, KDRect rect, Axis axis, float step, KDColor boldColor, KDColor lightColor) const {