diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index e6677cb..49a3f77 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -878,17 +878,17 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { float lin_grad_point = (height() - scene.track_vertices[i].y()) / height(); QColor base_color = QColor::fromRgb(base_red, base_green, base_blue); - float _h, _s, _l; + double _h, _s, _l; // Use double for compatibility with QColor::getHslF() base_color.getHslF(&_h, &_s, &_l); // Extracting HSL values from the base color // Calculate saturation and lightness based on acceleration float adjusted_saturation = std::min(std::abs(acceleration[i] * 1.5f), 1.f); - float adjusted_lightness = util::map_val(adjusted_saturation, 0.f, 1.f, _l, 0.95f); // Using base lightness as a starting point + float adjusted_lightness = util::map_val(adjusted_saturation, 0.f, 1.f, static_cast(_l), 0.95f); // Using base lightness as a starting point // Calculate dynamic alpha based on lin_grad_point float dynamic_alpha = util::map_val(lin_grad_point, 0.75f / 2.f, 0.75f, base_alpha, 0.f); - QColor final_color = QColor::fromHslF(_h / 360.f, adjusted_saturation, adjusted_lightness, dynamic_alpha); + QColor final_color = QColor::fromHslF(static_cast(_h / 360.f), adjusted_saturation, adjusted_lightness, dynamic_alpha); bg.setColorAt(lin_grad_point, final_color); i += (i + 2) < max_len ? 1 : 0; // Skipping a point to optimize rendering