aboutsummaryrefslogtreecommitdiff
path: root/include/AsyncImageLoader.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-24 15:12:49 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-24 15:12:49 +0100
commit97e9fcb00af17d0fd1220ce2a5b4f264bf83e8cf (patch)
tree36434fc08fd1c790dd3fdae2a4b16617b32d3251 /include/AsyncImageLoader.hpp
parentba97f72453b76942b6eba9c6f2134b64cb1304c5 (diff)
Make async image loader static to reduce number of process threads when using multiple instances
Diffstat (limited to 'include/AsyncImageLoader.hpp')
-rw-r--r--include/AsyncImageLoader.hpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/AsyncImageLoader.hpp b/include/AsyncImageLoader.hpp
index c1c2e11..5de9215 100644
--- a/include/AsyncImageLoader.hpp
+++ b/include/AsyncImageLoader.hpp
@@ -29,14 +29,18 @@ namespace QuickMedia {
class AsyncImageLoader {
public:
- AsyncImageLoader();
- ~AsyncImageLoader();
+ static AsyncImageLoader& get_instance();
// Returns false if the image loader is already loading an image. In that case, this function should be called again later.
// set |resize_target_size| to {0, 0} to disable resizing.
// |thumbnail_data.loading_state| has to be LoadingState::NOT_LOADED when calling this!
// Note: this method is not thread-safe
void load_thumbnail(const std::string &url, bool local, sf::Vector2i resize_target_size, bool use_tor, std::shared_ptr<ThumbnailData> thumbnail_data);
private:
+ AsyncImageLoader();
+ ~AsyncImageLoader();
+ AsyncImageLoader(AsyncImageLoader &other) = delete;
+ AsyncImageLoader& operator=(AsyncImageLoader &other) = delete;
+
struct ThumbnailLoadData {
Path path;
Path thumbnail_path;