mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:47:35 +00:00
DisplaySettings: Improve wallpaper preview code
Previously, this code would create a bitmap with the size of the screen resolution, draw the new wallpaper into it, and then scale it down for display inside the MonitorWidget. This was done on every paint event, which made the code quite slow and allocation-happy. Instead of this, we now scale down the new wallpaper to a miniature of the same scale as the little MonitorWidget screen. The miniature is then used for tiling, etc. The miniature is cached and reused across paint events if nothing else changes.
This commit is contained in:
parent
df5f382b50
commit
3046b3467c
2 changed files with 55 additions and 25 deletions
|
@ -32,13 +32,17 @@ public:
|
|||
private:
|
||||
MonitorWidget();
|
||||
|
||||
void redraw_desktop_if_needed();
|
||||
|
||||
virtual void paint_event(GUI::PaintEvent& event) override;
|
||||
|
||||
Gfx::IntRect m_monitor_rect;
|
||||
RefPtr<Gfx::Bitmap> m_monitor_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_desktop_bitmap;
|
||||
bool m_desktop_dirty { true };
|
||||
|
||||
String m_desktop_wallpaper_path;
|
||||
RefPtr<Gfx::Bitmap> m_desktop_wallpaper_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_wallpaper_bitmap;
|
||||
String m_desktop_wallpaper_mode;
|
||||
Gfx::IntSize m_desktop_resolution;
|
||||
int m_desktop_scale_factor { 1 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue