mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:47:45 +00:00
PixelPaint: Split bitmap() of Layer into {content, display}_bitmap
This is in preparation to support masking of Layers. We now distinguish between the "display_bitmap" which will be the whole Layer with every effect applied and the "content_bitmap" which contains the actual unmodified pixels in the Layer.
This commit is contained in:
parent
b6510f8e76
commit
31a9196bfe
14 changed files with 73 additions and 42 deletions
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
* Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -35,9 +36,11 @@ public:
|
|||
Gfx::IntPoint const& location() const { return m_location; }
|
||||
void set_location(Gfx::IntPoint const& location) { m_location = location; }
|
||||
|
||||
Gfx::Bitmap const& bitmap() const { return *m_bitmap; }
|
||||
Gfx::Bitmap& bitmap() { return *m_bitmap; }
|
||||
Gfx::IntSize size() const { return bitmap().size(); }
|
||||
Gfx::Bitmap const& display_bitmap() const { return m_cached_display_bitmap; }
|
||||
Gfx::Bitmap const& content_bitmap() const { return m_content_bitmap; }
|
||||
Gfx::Bitmap& content_bitmap() { return m_content_bitmap; }
|
||||
|
||||
Gfx::IntSize size() const { return content_bitmap().size(); }
|
||||
|
||||
Gfx::IntRect relative_rect() const { return { location(), size() }; }
|
||||
Gfx::IntRect rect() const { return { {}, size() }; }
|
||||
|
@ -45,7 +48,7 @@ public:
|
|||
String const& name() const { return m_name; }
|
||||
void set_name(String);
|
||||
|
||||
void set_bitmap(NonnullRefPtr<Gfx::Bitmap> bitmap) { m_bitmap = move(bitmap); }
|
||||
void set_content_bitmap(NonnullRefPtr<Gfx::Bitmap> bitmap);
|
||||
|
||||
void did_modify_bitmap(Gfx::IntRect const& = {});
|
||||
|
||||
|
@ -71,12 +74,15 @@ private:
|
|||
|
||||
String m_name;
|
||||
Gfx::IntPoint m_location;
|
||||
NonnullRefPtr<Gfx::Bitmap> m_bitmap;
|
||||
NonnullRefPtr<Gfx::Bitmap> m_content_bitmap;
|
||||
NonnullRefPtr<Gfx::Bitmap> m_cached_display_bitmap;
|
||||
|
||||
bool m_selected { false };
|
||||
bool m_visible { true };
|
||||
|
||||
int m_opacity_percent { 100 };
|
||||
|
||||
void update_cached_bitmap();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue