diff options
author | kleines Filmröllchen <filmroellchen@serenityos.org> | 2022-08-13 13:02:22 +0200 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-09-27 14:23:11 +0100 |
commit | 056b081e2d6fde75929ed56c3ce7054105d4e763 (patch) | |
tree | 00909f0d04b50703ad421d070f9e41b2422e33ee /Userland/Applications/PixelPaint | |
parent | 5f76ab9836aaf5ae4c2a083b9f3284b3deb401fa (diff) | |
download | serenity-056b081e2d6fde75929ed56c3ce7054105d4e763.zip |
PixelPaint: Reference-count filters
For multi-threading filter application, shared ownership is much easier
to work with.
Diffstat (limited to 'Userland/Applications/PixelPaint')
-rw-r--r-- | Userland/Applications/PixelPaint/FilterTreeModel.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/FilterTreeModel.h | 4 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/Filters/Filter.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Applications/PixelPaint/FilterTreeModel.cpp b/Userland/Applications/PixelPaint/FilterTreeModel.cpp index fd58238e99..11a2b7486d 100644 --- a/Userland/Applications/PixelPaint/FilterTreeModel.cpp +++ b/Userland/Applications/PixelPaint/FilterTreeModel.cpp @@ -32,7 +32,7 @@ ErrorOr<NonnullRefPtr<GUI::TreeViewModel>> create_filter_tree_model(ImageEditor* auto filter_tree_model = GUI::TreeViewModel::create(); auto add_filter_node = [&]<typename FilterType>(GUI::TreeViewModel::Node& node) { - auto filter = adopt_own(*new FilterType(editor)); + auto filter = make_ref_counted<FilterType>(editor); (void)node.add_node<FilterNode>(filter->filter_name(), filter_icon, move(filter)); }; diff --git a/Userland/Applications/PixelPaint/FilterTreeModel.h b/Userland/Applications/PixelPaint/FilterTreeModel.h index 48a4645c89..fa3c16e175 100644 --- a/Userland/Applications/PixelPaint/FilterTreeModel.h +++ b/Userland/Applications/PixelPaint/FilterTreeModel.h @@ -16,7 +16,7 @@ namespace PixelPaint { class FilterNode final : public GUI::TreeViewModel::Node { public: - FilterNode(String text, Optional<GUI::Icon> icon, Node* parent_node, NonnullOwnPtr<Filter> filter) + FilterNode(String text, Optional<GUI::Icon> icon, Node* parent_node, NonnullRefPtr<Filter> filter) : Node(move(text), move(icon), parent_node) , m_filter(move(filter)) { @@ -26,7 +26,7 @@ public: Filter& filter() { return *m_filter; } private: - NonnullOwnPtr<Filter> m_filter; + NonnullRefPtr<Filter> m_filter; }; ErrorOr<NonnullRefPtr<GUI::TreeViewModel>> create_filter_tree_model(ImageEditor*); diff --git a/Userland/Applications/PixelPaint/Filters/Filter.h b/Userland/Applications/PixelPaint/Filters/Filter.h index 9d0ac330fe..67792a4619 100644 --- a/Userland/Applications/PixelPaint/Filters/Filter.h +++ b/Userland/Applications/PixelPaint/Filters/Filter.h @@ -13,7 +13,7 @@ namespace PixelPaint { -class Filter { +class Filter : public RefCounted<Filter> { public: virtual void apply() const; virtual void apply(Gfx::Bitmap& target_bitmap, Gfx::Bitmap const& source_bitmap) const = 0; |