mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-27 17:02:04 +08:00
OnroadAlerts: construct QPainter only when needed (#21260)
This commit is contained in:
@@ -148,8 +148,6 @@ void OnroadAlerts::stopSounds() {
|
||||
}
|
||||
|
||||
void OnroadAlerts::paintEvent(QPaintEvent *event) {
|
||||
QPainter p(this);
|
||||
|
||||
if (alert_size == cereal::ControlsState::AlertSize::NONE) {
|
||||
return;
|
||||
}
|
||||
@@ -161,6 +159,8 @@ void OnroadAlerts::paintEvent(QPaintEvent *event) {
|
||||
int h = alert_sizes[alert_size];
|
||||
QRect r = QRect(0, height() - h, width(), h);
|
||||
|
||||
QPainter p(this);
|
||||
|
||||
// draw background + gradient
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
||||
|
||||
Reference in New Issue
Block a user