diff options
Diffstat (limited to 'src/FbTk/ImageControl.cc')
-rw-r--r-- | src/FbTk/ImageControl.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/FbTk/ImageControl.cc b/src/FbTk/ImageControl.cc index a5e5cd1..9eaec31 100644 --- a/src/FbTk/ImageControl.cc +++ b/src/FbTk/ImageControl.cc | |||
@@ -175,7 +175,7 @@ struct ImageControl::Cache { | |||
175 | }; | 175 | }; |
176 | 176 | ||
177 | ImageControl::ImageControl(int screen_num, | 177 | ImageControl::ImageControl(int screen_num, |
178 | int cpc, unsigned long cache_timeout, unsigned long cmax): | 178 | int cpc, unsigned int cache_timeout, unsigned long cmax): |
179 | m_colors_per_channel(cpc), | 179 | m_colors_per_channel(cpc), |
180 | m_screen_num(screen_num) { | 180 | m_screen_num(screen_num) { |
181 | 181 | ||
@@ -187,12 +187,9 @@ ImageControl::ImageControl(int screen_num, | |||
187 | 187 | ||
188 | cache_max = cmax; | 188 | cache_max = cmax; |
189 | 189 | ||
190 | if (cache_timeout && s_timed_cache) { | 190 | RefCount<Command<void> > clean_cache(new SimpleCommand<ImageControl>(*this, &ImageControl::cleanCache)); |
191 | m_timer.setTimeout(cache_timeout); | 191 | m_timer.setCommand(clean_cache); |
192 | RefCount<Command<void> > clean_cache(new SimpleCommand<ImageControl>(*this, &ImageControl::cleanCache)); | 192 | setCacheTimeout(cache_timeout); |
193 | m_timer.setCommand(clean_cache); | ||
194 | m_timer.start(); | ||
195 | } | ||
196 | 193 | ||
197 | createColorTable(); | 194 | createColorTable(); |
198 | } | 195 | } |
@@ -221,6 +218,13 @@ ImageControl::~ImageControl() { | |||
221 | } | 218 | } |
222 | } | 219 | } |
223 | 220 | ||
221 | void ImageControl::setCacheTimeout(unsigned int cache_timeout) { | ||
222 | if (cache_timeout && s_timed_cache) { | ||
223 | m_timer.setTimeout(cache_timeout * 60000l); | ||
224 | m_timer.start(); | ||
225 | } else | ||
226 | m_timer.stop(); | ||
227 | } | ||
224 | 228 | ||
225 | Pixmap ImageControl::searchCache(unsigned int width, unsigned int height, | 229 | Pixmap ImageControl::searchCache(unsigned int width, unsigned int height, |
226 | const Texture &text, FbTk::Orientation orient) const { | 230 | const Texture &text, FbTk::Orientation orient) const { |