mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:57:44 +00:00
BitmapView: Disable mutations of the underlying Bitmap
Problem: - `BitmapView` permits changing the underlying `Bitmap`. This violates the idea of a "view" since views are simply overlays which can themselves change but do not change the underlying data. Solution: - Migrate all non-`const` member functions to Bitmap.
This commit is contained in:
parent
ba9b3dc656
commit
f25209113f
3 changed files with 82 additions and 97 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/BitmapView.h>
|
||||
#include <AK/Bitmap.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <AK/Vector.h>
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
Heap(u8* memory, size_t memory_size)
|
||||
: m_total_chunks(calculate_chunks(memory_size))
|
||||
, m_chunks(memory)
|
||||
, m_bitmap(memory + m_total_chunks * CHUNK_SIZE, m_total_chunks)
|
||||
, m_bitmap(m_total_chunks, false)
|
||||
{
|
||||
// To keep the alignment of the memory passed in, place the bitmap
|
||||
// at the end of the memory block.
|
||||
|
@ -153,7 +153,7 @@ private:
|
|||
size_t m_total_chunks { 0 };
|
||||
size_t m_allocated_chunks { 0 };
|
||||
u8* m_chunks { nullptr };
|
||||
BitmapView m_bitmap;
|
||||
Bitmap m_bitmap;
|
||||
};
|
||||
|
||||
template<typename ExpandHeap>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue