WindowServer: Don't reallocate the cursor back bitmap all the time in HighDPI mode

It's in efficient, and it also meant we wouldn't reallocate a bigger
backing bitmap in a lowdpi->highdpi transition, leading to minor drawing
glitches after such a transition.

(Whoops!)
This commit is contained in:
Nico Weber 2021-01-15 14:56:01 -05:00 committed by Andreas Kling
parent 476a3acfb2
commit 248d75e13b
Notes: sideshowbarker 2024-07-18 23:48:17 +09:00

View File

@ -802,8 +802,9 @@ void Compositor::draw_cursor(const Gfx::IntRect& cursor_rect)
{
auto& wm = WindowManager::the();
if (!m_cursor_back_bitmap || m_cursor_back_bitmap->size() != cursor_rect.size()) {
m_cursor_back_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, cursor_rect.size() * Screen::the().scale_factor());
auto physical_cursor_size = cursor_rect.size() * Screen::the().scale_factor();
if (!m_cursor_back_bitmap || m_cursor_back_bitmap->size() != physical_cursor_size) {
m_cursor_back_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, physical_cursor_size);
m_cursor_back_painter = make<Gfx::Painter>(*m_cursor_back_bitmap);
}