diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/FbTk/ImageControl.cc | 9 | ||||
-rw-r--r-- | src/FbTk/ImageControl.hh | 5 | ||||
-rw-r--r-- | src/FbTk/Menu.cc | 18 |
4 files changed, 30 insertions, 5 deletions
@@ -1,5 +1,8 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 1.1 | 2 | Changes for 1.1 |
3 | *08/09/14: | ||
4 | * Fixed a minor pixmap resource leak (Henrik) | ||
5 | FbTk/Menu.cc, FbTk/ImageControl.cc/hh | ||
3 | *08/09/01: | 6 | *08/09/01: |
4 | * When the current menu item gets disabled, highlight its nearest neighbor | 7 | * When the current menu item gets disabled, highlight its nearest neighbor |
5 | and add separators to the focus model menu (Mark) | 8 | and add separators to the focus model menu (Mark) |
diff --git a/src/FbTk/ImageControl.cc b/src/FbTk/ImageControl.cc index 38114c8..067bcde 100644 --- a/src/FbTk/ImageControl.cc +++ b/src/FbTk/ImageControl.cc | |||
@@ -227,11 +227,18 @@ Pixmap ImageControl::searchCache(unsigned int width, unsigned int height, | |||
227 | 227 | ||
228 | Pixmap ImageControl::renderImage(unsigned int width, unsigned int height, | 228 | Pixmap ImageControl::renderImage(unsigned int width, unsigned int height, |
229 | const FbTk::Texture &texture, | 229 | const FbTk::Texture &texture, |
230 | FbTk::Orientation orient) { | 230 | FbTk::Orientation orient, |
231 | bool use_cache ) { | ||
231 | 232 | ||
232 | if (texture.type() & FbTk::Texture::PARENTRELATIVE) | 233 | if (texture.type() & FbTk::Texture::PARENTRELATIVE) |
233 | return ParentRelative; | 234 | return ParentRelative; |
234 | 235 | ||
236 | // If we are not suppose to cache this pixmap, just render and return it | ||
237 | if ( ! use_cache) { | ||
238 | TextureRender image(*this, width, height, orient, m_colors, m_num_colors); | ||
239 | return image.render(texture); | ||
240 | } | ||
241 | |||
235 | // search cache first | 242 | // search cache first |
236 | Pixmap pixmap = searchCache(width, height, texture, orient); | 243 | Pixmap pixmap = searchCache(width, height, texture, orient); |
237 | if (pixmap) { | 244 | if (pixmap) { |
diff --git a/src/FbTk/ImageControl.hh b/src/FbTk/ImageControl.hh index a9c2eb7..b7b90f7 100644 --- a/src/FbTk/ImageControl.hh +++ b/src/FbTk/ImageControl.hh | |||
@@ -54,11 +54,14 @@ public: | |||
54 | @param width width of pixmap | 54 | @param width width of pixmap |
55 | @param height height of pixmap | 55 | @param height height of pixmap |
56 | @param src_texture texture type to render | 56 | @param src_texture texture type to render |
57 | @param orient Orientation of the texture. | ||
58 | @param use_cache whether or not to use cache | ||
57 | @return pixmap of the rendered image, on failure None | 59 | @return pixmap of the rendered image, on failure None |
58 | */ | 60 | */ |
59 | Pixmap renderImage(unsigned int width, unsigned int height, | 61 | Pixmap renderImage(unsigned int width, unsigned int height, |
60 | const FbTk::Texture &src_texture, | 62 | const FbTk::Texture &src_texture, |
61 | Orientation orient = ROT0); | 63 | Orientation orient = ROT0, |
64 | bool use_cache = true); | ||
62 | 65 | ||
63 | void installRootColormap(); | 66 | void installRootColormap(); |
64 | void removeImage(Pixmap thepix); | 67 | void removeImage(Pixmap thepix); |
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index f4e8f3d..7d50302 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -460,12 +460,24 @@ void Menu::updateMenu(int active_index) { | |||
460 | 460 | ||
461 | if (!theme()->selectedPixmap().pixmap().drawable()) { | 461 | if (!theme()->selectedPixmap().pixmap().drawable()) { |
462 | int hw = theme()->itemHeight() / 2; | 462 | int hw = theme()->itemHeight() / 2; |
463 | theme()->setSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme()->hiliteTexture()), true); | 463 | // render image, disable cache and let the theme remove the pixmap |
464 | theme()->setSelectedPixmap(m_image_ctrl. | ||
465 | renderImage(hw, hw, | ||
466 | theme()->hiliteTexture(), ROT0, | ||
467 | false // no cache | ||
468 | ), | ||
469 | false); // the theme takes care of this pixmap | ||
464 | 470 | ||
465 | if (!theme()->highlightSelectedPixmap().pixmap().drawable()) { | 471 | if (!theme()->highlightSelectedPixmap().pixmap().drawable()) { |
466 | int hw = theme()->itemHeight() / 2; | 472 | int hw = theme()->itemHeight() / 2; |
467 | theme()->setHighlightSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme()->frameTexture()), true); | 473 | // render image, disable cache and let the theme remove the pixmap |
468 | } | 474 | theme()->setHighlightSelectedPixmap(m_image_ctrl. |
475 | renderImage(hw, hw, | ||
476 | theme()->frameTexture(), ROT0, | ||
477 | false // no cache | ||
478 | ), | ||
479 | false); // theme takes care of this pixmap | ||
480 | } | ||
469 | } | 481 | } |
470 | 482 | ||
471 | if (m_title_vis) { | 483 | if (m_title_vis) { |