[app/shared] CurveView: simplify implementation of

pixelLengthToFloatLength (avoid avoidable overflows)
This commit is contained in:
Émilie Feral
2020-10-01 13:39:37 +02:00
parent 5b4fc6ff84
commit 64ff5b4c70

View File

@@ -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 {