src/hbcore/image/hbframedrawer.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
   978         frameParts = 0;
   978         frameParts = 0;
   979     }
   979     }
   980 }
   980 }
   981 
   981 
   982 /*!
   982 /*!
   983 *   Resets the MaskableIcon
   983  * Drops the underlying icon(s).  No need to send an unload req to server because the
   984 */
   984  * server drops the icon by itself in this case.
       
   985  */
   985 void HbFrameDrawerPrivate::resetMaskableIcon()
   986 void HbFrameDrawerPrivate::resetMaskableIcon()
   986 {
   987 {
   987 #if defined(HB_SGIMAGE_ICON) || defined(HB_NVG_CS_ICON)
       
   988     HbIconLoader *loader = HbIconLoader::global();
   988     HbIconLoader *loader = HbIconLoader::global();
   989     if (icon) {
   989     if (icon) {
   990         //consolidated icon case
   990         //consolidated icon case
   991         icon->decrementRefCount();
   991         icon->decrementRefCount();
   992         if (icon->refCount() == 0 && icon->isCreatedOnServer()) {
   992         if (icon->refCount() == 0) {
   993             // remove the item from cache and delete the icon
   993             // remove the item from cache and delete the icon
   994             loader->removeItemInCache(icon->iconImpl());
   994             if (loader) {
       
   995                 loader->removeItemInCache(icon->iconImpl());
       
   996             }
   995             icon->dispose();
   997             icon->dispose();
   996         }
   998         }
   997         icon = 0;
   999         icon = 0;
   998     } else {
  1000     } else {
   999         int count = fallbackMaskableIconList.count();
  1001         int count = fallbackMaskableIconList.count();
  1000         if (count) {
  1002         if (count) {
  1001             // for each item in fallbackMaskableIconList - decrement the reference count and
  1003             // for each item in fallbackMaskableIconList - decrement the reference count and
  1002             // remove the item in cache, dispose if needed.
  1004             // remove the item in cache, dispose if needed.
  1003             foreach(HbMaskableIconImpl * impl, fallbackMaskableIconList) {
  1005             foreach(HbMaskableIconImpl * impl, fallbackMaskableIconList) {
  1004                 impl->decrementRefCount();
  1006                 impl->decrementRefCount();
  1005                 if (impl->refCount() == 0 && impl->isCreatedOnServer()) {
  1007                 if (impl->refCount() == 0) {
  1006                     loader->removeItemInCache(impl->iconImpl());
  1008                     if (loader) {
       
  1009                         loader->removeItemInCache(impl->iconImpl());
       
  1010                     }
  1007                     impl->dispose();
  1011                     impl->dispose();
  1008                 }
  1012                 }
  1009             }
  1013             }
  1010             fallbackMaskableIconList.clear();
  1014             fallbackMaskableIconList.clear();
  1011         }
  1015         }
  1012     }
  1016     }
  1013     frameParts = 0;
  1017     frameParts = 0;
  1014 #endif
       
  1015 }
  1018 }
  1016 
  1019 
  1017 HbIconLoader::IconLoaderOptions HbFrameDrawerPrivate::iconLoaderOptions()
  1020 HbIconLoader::IconLoaderOptions HbFrameDrawerPrivate::iconLoaderOptions()
  1018 {
  1021 {
  1019     HbIconLoader::IconLoaderOptions options = DEFAULT_OPTIONS;
  1022     HbIconLoader::IconLoaderOptions options = DEFAULT_OPTIONS;