aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/ImageImlib2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/ImageImlib2.cc')
-rw-r--r--src/FbTk/ImageImlib2.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/FbTk/ImageImlib2.cc b/src/FbTk/ImageImlib2.cc
index 5bac7a4..69fc333 100644
--- a/src/FbTk/ImageImlib2.cc
+++ b/src/FbTk/ImageImlib2.cc
@@ -30,11 +30,20 @@
30 30
31namespace { 31namespace {
32 32
33typedef std::map<int, Imlib_Context> ScreenImlibContextContainer; 33class ScreenImlibContextContainer : public std::map<int, Imlib_Context> {
34public:
35 ~ScreenImlibContextContainer() {
36
37 std::map<int, Imlib_Context>::iterator it = this->begin();
38 std::map<int, Imlib_Context>::iterator it_end = this->end();
39 for (; it != it_end; it++) {
40 imlib_context_free(it->second);
41 }
42 }
43};
34typedef ScreenImlibContextContainer::iterator ScreenImlibContext; 44typedef ScreenImlibContextContainer::iterator ScreenImlibContext;
35 45
36ScreenImlibContextContainer contexts; 46ScreenImlibContextContainer contexts;
37
38} // anon namespace 47} // anon namespace
39 48
40 49
@@ -69,16 +78,6 @@ ImageImlib2::ImageImlib2() {
69 } 78 }
70} 79}
71 80
72ImageImlib2::~ImageImlib2() {
73
74 ScreenImlibContext it = contexts.begin();
75 ScreenImlibContext it_end = contexts.end();
76 for (; it != it_end; it++) {
77 imlib_context_free(it->second);
78 }
79 contexts.clear();
80}
81
82PixmapWithMask *ImageImlib2::load(const std::string &filename, int screen_num) const { 81PixmapWithMask *ImageImlib2::load(const std::string &filename, int screen_num) const {
83 82
84 Display *dpy = FbTk::App::instance()->display(); 83 Display *dpy = FbTk::App::instance()->display();