summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-01-15 14:56:01 -0500
committerAndreas Kling <kling@serenityos.org>2021-01-15 22:05:08 +0100
commit248d75e13b6345b94d608f057b7ab5a3e95fb65d (patch)
tree1a5591085aff73663e0f2d5de470a8049178728e /Userland/Services/WindowServer
parent476a3acfb21f58c69476e32d34eb1002dbc4ae28 (diff)
downloadserenity-248d75e13b6345b94d608f057b7ab5a3e95fb65d.zip
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!)
Diffstat (limited to 'Userland/Services/WindowServer')
-rw-r--r--Userland/Services/WindowServer/Compositor.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp
index d93b163335..4bea8d81a8 100644
--- a/Userland/Services/WindowServer/Compositor.cpp
+++ b/Userland/Services/WindowServer/Compositor.cpp
@@ -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);
}