[apps/shared/curve_view] Fix rounding error in drawSegment

This commit is contained in:
Ruben Dashyan
2019-07-16 09:53:55 +02:00
committed by EmilieNumworks
parent 503995746a
commit f5c3cb74e2

View File

@@ -374,14 +374,14 @@ void CurveView::drawSegment(KDContext * ctx, KDRect rect, Axis axis, float coord
switch(axis) {
case Axis::Horizontal:
lineRect = KDRect(
std::round(floatToPixel(Axis::Horizontal, lowerBound)), std::round(floatToPixel(Axis::Vertical, coordinate)),
std::round(floatToPixel(Axis::Horizontal, upperBound) - floatToPixel(Axis::Horizontal, lowerBound)), thickness
);
std::round(floatToPixel(Axis::Horizontal, lowerBound)), std::round(floatToPixel(Axis::Vertical, coordinate)),
std::round(floatToPixel(Axis::Horizontal, upperBound)) - std::round(floatToPixel(Axis::Horizontal, lowerBound)), thickness
);
break;
case Axis::Vertical:
lineRect = KDRect(
std::round(floatToPixel(Axis::Horizontal, coordinate)), std::round(floatToPixel(Axis::Vertical, upperBound)),
thickness, std::round(floatToPixel(Axis::Vertical, lowerBound) - floatToPixel(Axis::Vertical, upperBound))
std::round(floatToPixel(Axis::Horizontal, coordinate)), std::round(floatToPixel(Axis::Vertical, upperBound)),
thickness, std::round(floatToPixel(Axis::Vertical, lowerBound)) - std::round(floatToPixel(Axis::Vertical, upperBound))
);
break;
}