mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
LibDraw: Add GraphicsBitmap::create_purgeable()
This allows you to create a process-private purgeable GraphicsBitmap. The volatile flag is controlled via set_volatile() / set_nonvolatile().
This commit is contained in:
parent
72ec2fae6e
commit
77ae98a9b6
2 changed files with 47 additions and 4 deletions
|
@ -20,6 +20,7 @@ public:
|
|||
};
|
||||
|
||||
static NonnullRefPtr<GraphicsBitmap> create(Format, const Size&);
|
||||
static NonnullRefPtr<GraphicsBitmap> create_purgeable(Format, const Size&);
|
||||
static NonnullRefPtr<GraphicsBitmap> create_wrapper(Format, const Size&, size_t pitch, RGBA32*);
|
||||
static RefPtr<GraphicsBitmap> load_from_file(const StringView& path);
|
||||
static RefPtr<GraphicsBitmap> load_from_file(Format, const StringView& path, const Size&);
|
||||
|
@ -98,8 +99,14 @@ public:
|
|||
set_pixel(position.x(), position.y(), color);
|
||||
}
|
||||
|
||||
bool is_purgeable() const { return m_purgeable; }
|
||||
bool is_volatile() const { return m_volatile; }
|
||||
void set_volatile();
|
||||
[[nodiscard]] bool set_nonvolatile();
|
||||
|
||||
private:
|
||||
GraphicsBitmap(Format, const Size&);
|
||||
enum class Purgeable { No, Yes };
|
||||
GraphicsBitmap(Format, const Size&, Purgeable);
|
||||
GraphicsBitmap(Format, const Size&, size_t pitch, RGBA32*);
|
||||
GraphicsBitmap(Format, const Size&, MappedFile&&);
|
||||
GraphicsBitmap(Format, NonnullRefPtr<SharedBuffer>&&, const Size&);
|
||||
|
@ -110,6 +117,8 @@ private:
|
|||
size_t m_pitch { 0 };
|
||||
Format m_format { Format::Invalid };
|
||||
bool m_needs_munmap { false };
|
||||
bool m_purgeable { false };
|
||||
bool m_volatile { false };
|
||||
MappedFile m_mapped_file;
|
||||
RefPtr<SharedBuffer> m_shared_buffer;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue