1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:57:45 +00:00

WindowServer: Load multiple scaled versions of Bitmaps and Cursors

This enables rendering of mixed-scale screen layouts with e.g. high
resolution cursors and window button icons on high-dpi screens while
using lower resolution bitmaps on regular screens.
This commit is contained in:
Tom 2021-06-18 19:21:30 -06:00 committed by Andreas Kling
parent aa15bf81e4
commit 61af9d882e
15 changed files with 269 additions and 99 deletions

View file

@ -11,10 +11,12 @@
#include <LibGfx/Bitmap.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Rect.h>
#include <WindowServer/MultiScaleBitmaps.h>
namespace WindowServer {
class MouseEvent;
class Screen;
class WindowFrame;
class Button : public Weakable<Button> {
@ -28,7 +30,7 @@ public:
Gfx::IntRect rect() const { return { {}, m_relative_rect.size() }; }
Gfx::IntRect screen_rect() const;
void paint(Gfx::Painter&);
void paint(Screen&, Gfx::Painter&);
void on_mouse_event(const MouseEvent&);
@ -38,12 +40,12 @@ public:
bool is_visible() const { return m_visible; }
void set_icon(const Gfx::Bitmap& icon) { m_icon = icon; }
void set_icon(const RefPtr<MultiScaleBitmaps>& icon) { m_icon = icon; }
private:
WindowFrame& m_frame;
Gfx::IntRect m_relative_rect;
RefPtr<Gfx::Bitmap> m_icon;
RefPtr<MultiScaleBitmaps> m_icon;
bool m_pressed { false };
bool m_visible { true };
bool m_hovered { false };