mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
AK+Kernel: Make BitmapView read-only
This commit is contained in:
parent
850db15d66
commit
bf7a2ff941
Notes:
sideshowbarker
2024-07-18 01:20:15 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/bf7a2ff941e Pull-request: https://github.com/SerenityOS/serenity/pull/10824 Reviewed-by: https://github.com/ADKaster
@ -37,7 +37,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
[[nodiscard]] BitmapView view() { return { m_data, m_size }; }
|
||||
[[nodiscard]] BitmapView const view() const { return { m_data, m_size }; }
|
||||
|
||||
Bitmap(Bitmap&& other)
|
||||
|
@ -32,14 +32,6 @@ public:
|
||||
VERIFY(index < m_size);
|
||||
return 0 != (m_data[index / 8] & (1u << (index % 8)));
|
||||
}
|
||||
void set(size_t index, bool value) const
|
||||
{
|
||||
VERIFY(index < m_size);
|
||||
if (value)
|
||||
m_data[index / 8] |= static_cast<u8>((1u << (index % 8)));
|
||||
else
|
||||
m_data[index / 8] &= static_cast<u8>(~(1u << (index % 8)));
|
||||
}
|
||||
|
||||
size_t count_slow(bool value) const
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/BitmapView.h>
|
||||
#include <AK/Bitmap.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <Kernel/FileSystem/BlockBasedFileSystem.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
@ -176,7 +176,7 @@ private:
|
||||
BlockIndex bitmap_block_index { 0 };
|
||||
bool dirty { false };
|
||||
NonnullOwnPtr<KBuffer> buffer;
|
||||
BitmapView bitmap(u32 blocks_per_group) { return BitmapView { buffer->data(), blocks_per_group }; }
|
||||
Bitmap bitmap(u32 blocks_per_group) { return Bitmap { buffer->data(), blocks_per_group }; }
|
||||
};
|
||||
|
||||
ErrorOr<CachedBitmap*> get_bitmap_block(BlockIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user