diff options
Diffstat (limited to 'src/FbTk/Image.cc')
-rw-r--r-- | src/FbTk/Image.cc | 45 |
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; | |||
42 | using std::list; | 42 | using std::list; |
43 | using std::set; | 43 | using std::set; |
44 | 44 | ||
45 | namespace FbTk { | ||
46 | 45 | ||
47 | Image::ImageMap Image::s_image_map; | 46 | namespace { |
48 | Image::StringList Image::s_search_paths; | ||
49 | 47 | ||
48 | typedef std::map<std::string, FbTk::ImageBase *> ImageMap; | ||
49 | typedef std::list<std::string> StringList; | ||
50 | 50 | ||
51 | void Image::init() { | 51 | ImageMap s_image_map; |
52 | StringList 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(); | 55 | FbTk::ImageImlib2 imlib2_loader; |
59 | #endif // HAVE_IMLIB2 | 56 | #endif |
60 | } | 57 | #ifdef HAVE_XPM |
61 | 58 | FbTk::ImageXPM xpm_loader; | |
62 | void 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(); | 64 | namespace FbTk { |
83 | } | ||
84 | 65 | ||
85 | PixmapWithMask *Image::load(const string &filename, int screen_num) { | 66 | PixmapWithMask *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 |