summaryrefslogtreecommitdiff
path: root/imgmanager.hpp
diff options
context:
space:
mode:
authorDylam De La Torre <DyXel04@gmail.com>2021-11-23 05:21:56 +0100
committerGitHub <noreply@github.com>2021-11-23 04:21:56 +0000
commita51a54bc5979a2491f152abc47ad54e6b63f27c8 (patch)
treece67092b2f6df366033a65a6111e4650866766b2 /imgmanager.hpp
parentd88079000a79e6bcbe51c5a2868d57b303b5fcb6 (diff)
downloadabaddon-portaudio-a51a54bc5979a2491f152abc47ad54e6b63f27c8.tar.gz
abaddon-portaudio-a51a54bc5979a2491f152abc47ad54e6b63f27c8.zip
Restructure source and resource files (#46)
importantly, res is now res/res and css is now res/css
Diffstat (limited to 'imgmanager.hpp')
-rw-r--r--imgmanager.hpp38
1 files changed, 0 insertions, 38 deletions
diff --git a/imgmanager.hpp b/imgmanager.hpp
deleted file mode 100644
index eb8a590..0000000
--- a/imgmanager.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma once
-#include <string>
-#include <unordered_map>
-#include <functional>
-#include <queue>
-#include <gtkmm.h>
-#include "filecache.hpp"
-
-class ImageManager {
-public:
- ImageManager();
-
- using callback_anim_type = sigc::slot<void(Glib::RefPtr<Gdk::PixbufAnimation>)>;
- using callback_type = sigc::slot<void(Glib::RefPtr<Gdk::Pixbuf>)>;
-
- Cache &GetCache();
- void ClearCache();
- void LoadFromURL(std::string url, callback_type cb);
- // animations need dimensions before loading since there is no (easy) way to scale a PixbufAnimation
- void LoadAnimationFromURL(std::string url, int w, int h, callback_anim_type cb);
- void Prefetch(std::string url);
- Glib::RefPtr<Gdk::Pixbuf> GetFromURLIfCached(std::string url);
- Glib::RefPtr<Gdk::PixbufAnimation> GetAnimationFromURLIfCached(std::string url, int w, int h);
- Glib::RefPtr<Gdk::Pixbuf> GetPlaceholder(int size);
-
-private:
- Glib::RefPtr<Gdk::Pixbuf> ReadFileToPixbuf(std::string path);
- Glib::RefPtr<Gdk::PixbufAnimation> ReadFileToPixbufAnimation(std::string path, int w, int h);
-
- mutable std::mutex m_load_mutex;
- void RunCallbacks();
- Glib::Dispatcher m_cb_dispatcher;
- mutable std::mutex m_cb_mutex;
- std::queue<std::function<void()>> m_cb_queue;
-
- std::unordered_map<std::string, Glib::RefPtr<Gdk::Pixbuf>> m_pixs;
- Cache m_cache;
-};