mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 11:39:44 +03:00
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:
parent
6998fa5c54
commit
41dc73adc4
Notes:
sideshowbarker
2024-07-18 18:28:07 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/41dc73adc46
@ -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&)
|
||||
|
@ -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++;
|
||||
|
@ -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&)
|
||||
|
@ -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()
|
||||
|
@ -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&)
|
||||
|
@ -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&)
|
||||
|
Loading…
Reference in New Issue
Block a user