Demos: Fix a bunch of incorrect use of GUI::PaintEvent::rect()

A bunch of programs were using the paint event rect as the rect
to draw into. Since the event rect could be any invalidated part
of the widget, we need to be passing the full Widget::rect().
This commit is contained in:
Andreas Kling 2021-05-09 10:11:30 +02:00
parent 6998fa5c54
commit 41dc73adc4
Notes: sideshowbarker 2024-07-18 18:28:07 +09:00
6 changed files with 8 additions and 14 deletions

View File

@ -78,9 +78,7 @@ void Cube::paint_event(GUI::PaintEvent& event)
{
GUI::Painter painter(*this);
painter.add_clip_rect(event.rect());
/* Blit it! */
painter.draw_scaled_bitmap(event.rect(), *m_bitmap, m_bitmap->rect());
painter.draw_scaled_bitmap(rect(), *m_bitmap, m_bitmap->rect());
}
void Cube::timer_event(Core::TimerEvent&)

View File

@ -118,9 +118,7 @@ void Fire::paint_event(GUI::PaintEvent& event)
GUI::Painter painter(*this);
painter.add_clip_rect(event.rect());
/* Blit it! */
painter.draw_scaled_bitmap(event.rect(), *bitmap, bitmap->rect());
painter.draw_scaled_bitmap(rect(), *bitmap, bitmap->rect());
timeAvg += timer.elapsed();
cycles++;

View File

@ -62,9 +62,7 @@ void GLContextWidget::paint_event(GUI::PaintEvent& event)
{
GUI::Painter painter(*this);
painter.add_clip_rect(event.rect());
/* Blit it! */
painter.draw_scaled_bitmap(event.rect(), *m_bitmap, m_bitmap->rect());
painter.draw_scaled_bitmap(rect(), *m_bitmap, m_bitmap->rect());
}
void GLContextWidget::timer_event(Core::TimerEvent&)

View File

@ -47,7 +47,8 @@ Canvas::~Canvas()
void Canvas::paint_event(GUI::PaintEvent& event)
{
GUI::Painter painter(*this);
painter.draw_scaled_bitmap(event.rect(), *m_bitmap, m_bitmap->rect());
painter.add_clip_rect(event.rect());
painter.draw_scaled_bitmap(rect(), *m_bitmap, m_bitmap->rect());
}
void Canvas::draw()

View File

@ -69,7 +69,8 @@ void Screensaver::keydown_event(GUI::KeyEvent&)
void Screensaver::paint_event(GUI::PaintEvent& event)
{
GUI::Painter painter(*this);
painter.draw_scaled_bitmap(event.rect(), *m_bitmap, m_bitmap->rect());
painter.add_clip_rect(event.rect());
painter.draw_scaled_bitmap(rect(), *m_bitmap, m_bitmap->rect());
}
void Screensaver::timer_event(Core::TimerEvent&)

View File

@ -90,11 +90,9 @@ void Starfield::keydown_event(GUI::KeyEvent&)
void Starfield::paint_event(GUI::PaintEvent& event)
{
GUI::Painter painter(*this);
painter.add_clip_rect(event.rect());
painter.draw_scaled_bitmap(event.rect(), *m_bitmap, m_bitmap->rect());
painter.draw_scaled_bitmap(rect(), *m_bitmap, m_bitmap->rect());
}
void Starfield::timer_event(Core::TimerEvent&)