From 66f4ef07d326db0784022dcfbb6e5ebb08cce7f9 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 3 Mar 2023 00:44:40 -0800 Subject: [PATCH] round --- selfdrive/ui/qt/onroad.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 8d8fc85710..63cc45c2c8 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -544,13 +544,15 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { // speed up: 120, slow down: 0 float path_hue = fmax(fmin(60 + acceleration[i] * 35, 120), 0); // FIXME: painter.drawPolygon can be slow if hue is not rounded - path_hue = int(path_hue * 100 + 0.5) / 100; +// path_hue = int(path_hue * 100 + 0.5) / 100; + path_hue = qRound(path_hue * 100) / 100; float saturation = fmin(fabs(acceleration[i] * 1.5), 1); float lightness = interp1d(saturation, 0.0, 1.0, 0.95, 0.62); // lighter when grey float alpha = interp1d(lin_grad_point, 0.75 / 2., 0.75, 0.4, 0.0); // matches previous alpha fade // (void(alpha)); // (void(lightness)); + lin_grad_point = qRound(lin_grad_point * 100) / 100.; bg.setColorAt(lin_grad_point, QColor::fromHslF(path_hue / 360., saturation, lightness, alpha)); }