From c75a7035867ca51dd425589d801add281b823267 Mon Sep 17 00:00:00 2001 From: akir Date: Thu, 9 Sep 2004 21:13:10 +0000 Subject: tiny cleanup to avoid calling unnecessary FbTk::App::instance() --- src/FbTk/ImageControl.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/FbTk/ImageControl.cc b/src/FbTk/ImageControl.cc index b06b623..e89b2cb 100644 --- a/src/FbTk/ImageControl.cc +++ b/src/FbTk/ImageControl.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ImageControl.cc,v 1.14 2004/08/31 15:26:39 rathnor Exp $ +// $Id: ImageControl.cc,v 1.15 2004/09/09 21:13:10 akir Exp $ #include "ImageControl.hh" @@ -139,13 +139,15 @@ ImageControl::~ImageControl() { delete [] grad_ybuffer; } + Display *disp = FbTk::App::instance()->display(); + if (m_colors) { unsigned long *pixels = new unsigned long [m_num_colors]; for (unsigned int color = 0; color < m_num_colors; color++) *(pixels + color) = (*(m_colors + color)).pixel; - XFreeColors(FbTk::App::instance()->display(), m_colormap, pixels, m_num_colors, 0); + XFreeColors(disp, m_colormap, pixels, m_num_colors, 0); delete [] m_colors; } @@ -153,7 +155,6 @@ ImageControl::~ImageControl() { if (cache.size() > 0) { CacheList::iterator it = cache.begin(); CacheList::iterator it_end = cache.end(); - Display *disp = FbTk::App::instance()->display(); for (; it != it_end; ++it) { XFreePixmap(disp, (*it)->pixmap); delete (*it); @@ -190,6 +191,7 @@ Pixmap ImageControl::searchCache(unsigned int width, unsigned int height, tmp.pixel1 = text.color().pixel(); tmp.pixel2 = text.colorTo().pixel(); */ + CacheList::iterator it = cache.begin(); CacheList::iterator it_end = cache.end(); for (; it != it_end; ++it) { -- cgit v0.11.2