aboutsummaryrefslogtreecommitdiff
path: root/src/AsyncImageLoader.cpp
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 /src/AsyncImageLoader.cpp
parentba97f72453b76942b6eba9c6f2134b64cb1304c5 (diff)
Make async image loader static to reduce number of process threads when using multiple instances
Diffstat (limited to 'src/AsyncImageLoader.cpp')
-rw-r--r--src/AsyncImageLoader.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp
index 136bd5b..d0a67c4 100644
--- a/src/AsyncImageLoader.cpp
+++ b/src/AsyncImageLoader.cpp
@@ -94,6 +94,13 @@ namespace QuickMedia {
}
}
+ AsyncImageLoader& AsyncImageLoader::get_instance() {
+ static AsyncImageLoader *instance = nullptr;
+ if(!instance)
+ instance = new AsyncImageLoader();
+ return *instance;
+ }
+
AsyncImageLoader::AsyncImageLoader() {
for(int i = 0; i < NUM_IMAGE_LOAD_THREADS; ++i) {
loading_image[i] = false;