mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
Cube: Two small tweaks
I noticed these when playing with the demo locally: - Use RGB32 instead of RGBA32 for the bitmap buffer. This avoids some flickering that would sometimes occur. - Clip the gradient fill to the widget rect rather than the painter clip rect. In practice, the painter was always clipped to the widget rect here, but it seems logical to say "fill widget with gradient."
This commit is contained in:
parent
fca08bd000
commit
9a109128f8
Notes:
sideshowbarker
2024-07-19 07:30:56 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9a109128f84
@ -62,7 +62,7 @@ private:
|
||||
|
||||
Cube::Cube()
|
||||
{
|
||||
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, { WIDTH, HEIGHT });
|
||||
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, { WIDTH, HEIGHT });
|
||||
|
||||
m_accumulated_time = 0;
|
||||
m_cycles = 0;
|
||||
@ -142,7 +142,7 @@ void Cube::timer_event(Core::TimerEvent&)
|
||||
}
|
||||
|
||||
GUI::Painter painter(*m_bitmap);
|
||||
painter.fill_rect_with_gradient(Gfx::Orientation::Vertical, painter.clip_rect(), Gfx::Color::White, Gfx::Color::Blue);
|
||||
painter.fill_rect_with_gradient(Gfx::Orientation::Vertical, m_bitmap->rect(), Gfx::Color::White, Gfx::Color::Blue);
|
||||
|
||||
auto to_point = [](const FloatVector3& v) {
|
||||
return Gfx::Point(v.x(), v.y());
|
||||
|
Loading…
Reference in New Issue
Block a user