diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-24 18:31:59 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-25 14:39:21 +0200 |
commit | 24b5295b3038dc0b7a49367476b5b8594268163d (patch) | |
tree | 61a774f809502fef1e54fabbae6fc066b3523745 /Userland/Libraries/LibGfx/Bitmap.h | |
parent | deec79b3c61b4444c54e0b159a517920ab841658 (diff) | |
download | serenity-24b5295b3038dc0b7a49367476b5b8594268163d.zip |
LibGfx: Remove "purgeable Gfx::Bitmap" as a separate concept
This was a really weird thing to begin with, purgeable bitmaps were
basically regular bitmaps without a physical memory reservation.
Since all the clients of this code ended up populating the bitmaps
with pixels immediately after allocating them anyway, there was no
need to avoid the reservation.
Instead, all Gfx::Bitmaps are now purgeable, in the sense that they
can be marked as volatile or non-volatile.
The only difference here is that allocation failure is surfaced when
we try to create the bitmap instead of during the handling of a
subsequent page fault.
Diffstat (limited to 'Userland/Libraries/LibGfx/Bitmap.h')
-rw-r--r-- | Userland/Libraries/LibGfx/Bitmap.h | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/Userland/Libraries/LibGfx/Bitmap.h b/Userland/Libraries/LibGfx/Bitmap.h index b08622f6c3..5481adb278 100644 --- a/Userland/Libraries/LibGfx/Bitmap.h +++ b/Userland/Libraries/LibGfx/Bitmap.h @@ -92,7 +92,6 @@ class Bitmap : public RefCounted<Bitmap> { public: [[nodiscard]] static RefPtr<Bitmap> try_create(BitmapFormat, const IntSize&, int intrinsic_scale = 1); [[nodiscard]] static RefPtr<Bitmap> try_create_shareable(BitmapFormat, const IntSize&, int intrinsic_scale = 1); - [[nodiscard]] static RefPtr<Bitmap> try_create_purgeable(BitmapFormat, const IntSize&, int intrinsic_scale = 1); [[nodiscard]] static RefPtr<Bitmap> try_create_wrapper(BitmapFormat, const IntSize&, int intrinsic_scale, size_t pitch, void*); [[nodiscard]] static RefPtr<Bitmap> try_load_from_file(String const& path, int scale_factor = 1); [[nodiscard]] static RefPtr<Bitmap> try_create_with_anonymous_buffer(BitmapFormat, Core::AnonymousBuffer, const IntSize&, int intrinsic_scale, const Vector<RGBA32>& palette); @@ -226,7 +225,6 @@ public: set_pixel(physical_position.x(), physical_position.y(), color); } - [[nodiscard]] bool is_purgeable() const { return m_purgeable; } [[nodiscard]] bool is_volatile() const { return m_volatile; } void set_volatile(); [[nodiscard]] bool set_nonvolatile(); @@ -235,15 +233,11 @@ public: [[nodiscard]] Core::AnonymousBuffer const& anonymous_buffer() const { return m_buffer; } private: - enum class Purgeable { - No, - Yes - }; - Bitmap(BitmapFormat, const IntSize&, int, Purgeable, const BackingStore&); + Bitmap(BitmapFormat, IntSize const&, int, BackingStore const&); Bitmap(BitmapFormat, const IntSize&, int, size_t pitch, void*); Bitmap(BitmapFormat, Core::AnonymousBuffer, const IntSize&, int, const Vector<RGBA32>& palette); - static Optional<BackingStore> try_allocate_backing_store(BitmapFormat format, IntSize const& size, int scale_factor, Purgeable); + static Optional<BackingStore> try_allocate_backing_store(BitmapFormat format, IntSize const& size, int scale_factor); void allocate_palette_from_format(BitmapFormat, const Vector<RGBA32>& source_palette); @@ -254,7 +248,6 @@ private: size_t m_pitch { 0 }; BitmapFormat m_format { BitmapFormat::Invalid }; bool m_needs_munmap { false }; - bool m_purgeable { false }; bool m_volatile { false }; Core::AnonymousBuffer m_buffer; }; |