aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Image.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Image.cc')
-rw-r--r--src/FbTk/Image.cc45
1 files changed, 13 insertions, 32 deletions
diff --git a/src/FbTk/Image.cc b/src/FbTk/Image.cc
index 020f9c6..0c7b5fc 100644
--- a/src/FbTk/Image.cc
+++ b/src/FbTk/Image.cc
@@ -42,50 +42,31 @@ using std::string;
42using std::list; 42using std::list;
43using std::set; 43using std::set;
44 44
45namespace FbTk {
46 45
47Image::ImageMap Image::s_image_map; 46namespace {
48Image::StringList Image::s_search_paths;
49 47
48typedef std::map<std::string, FbTk::ImageBase *> ImageMap;
49typedef std::list<std::string> StringList;
50 50
51void Image::init() { 51ImageMap s_image_map;
52StringList s_search_paths;
52 53
53// create imagehandlers for their extensions
54#ifdef HAVE_XPM
55 new ImageXPM();
56#endif // HAVE_XPM
57#ifdef HAVE_IMLIB2 54#ifdef HAVE_IMLIB2
58 new ImageImlib2(); 55FbTk::ImageImlib2 imlib2_loader;
59#endif // HAVE_IMLIB2 56#endif
60} 57#ifdef HAVE_XPM
61 58FbTk::ImageXPM xpm_loader;
62void Image::shutdown() { 59#endif
63
64 set<ImageBase*> handlers;
65 60
66 // one imagehandler could be registered
67 // for more than one type
68 ImageMap::iterator it = s_image_map.begin();
69 ImageMap::iterator it_end = s_image_map.end();
70 for (; it != it_end; it++) {
71 if (it->second)
72 handlers.insert(it->second);
73 }
74 61
75 // free the unique handlers 62}; // end of anonymous namespace
76 set<ImageBase*>::iterator handler_it = handlers.begin();
77 set<ImageBase*>::iterator handler_it_end = handlers.end();
78 for(; handler_it != handler_it_end; handler_it++) {
79 delete (*handler_it);
80 }
81 63
82 s_image_map.clear(); 64namespace FbTk {
83}
84 65
85PixmapWithMask *Image::load(const string &filename, int screen_num) { 66PixmapWithMask *Image::load(const string &filename, int screen_num) {
86 67
87 68
88 if (filename == "") 69 if (filename.empty())
89 return false; 70 return false;
90 71
91 // determine file ending 72 // determine file ending