mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 17:58:12 +00:00
LibGfx: Saner memory usage of indexed bitmaps
Indexed bitmaps used to allocate four times the required amount of memory. Also, we should acknowledge that the underlying data is not always RGBA32, and instead cast it only when the true type is known.
This commit is contained in:
parent
d6673b384e
commit
9c3a33762b
5 changed files with 89 additions and 86 deletions
|
@ -141,7 +141,7 @@ RefPtr<Gfx::Bitmap> Clipboard::bitmap() const
|
|||
if (!format.has_value() || format.value() == 0)
|
||||
return nullptr;
|
||||
|
||||
auto clipping_bitmap = Gfx::Bitmap::create_wrapper((Gfx::BitmapFormat)format.value(), { (int)width.value(), (int)height.value() }, pitch.value(), (Gfx::RGBA32*)clipping.data.data());
|
||||
auto clipping_bitmap = Gfx::Bitmap::create_wrapper((Gfx::BitmapFormat)format.value(), { (int)width.value(), (int)height.value() }, pitch.value(), clipping.data.data());
|
||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, { (int)width.value(), (int)height.value() });
|
||||
|
||||
for (int y = 0; y < clipping_bitmap->height(); ++y) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue