src/hbcore/image/hbiconengine.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 3 11d3954df52a
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
   721                 // If loading failed, store information so it is not retried.
   721                 // If loading failed, store information so it is not retried.
   722                 if (!d->icon) {
   722                 if (!d->icon) {
   723                     d->appendLoadFail(mode, state); 
   723                     d->appendLoadFail(mode, state); 
   724                 }
   724                 }
   725             }
   725             }
   726             if (d->icon){
   726             if (d->icon) {
       
   727                 d->pixmap = d->icon->pixmap();
   727                 // Draw badges on this pixmap
   728                 // Draw badges on this pixmap
   728                 QPainter painter(&d->pixmap);
   729                 QPainter painter(&d->pixmap);
   729                 if (d->badgeInfo){
   730                 if (d->badgeInfo){
   730                     d->badgeInfo->paint(&painter, QRectF(QPointF(0, 0), pixelSize), mode, state, d->isMirrored());
   731                     d->badgeInfo->paint(&painter, QRectF(QPointF(0, 0), pixelSize), mode, state, d->isMirrored());
   731                 }
   732                 }
   732                 d->pixmap = d->icon->pixmap();
       
   733                 return d->pixmap;
   733                 return d->pixmap;
   734             }
   734             }
   735         }
   735         }
   736     }
   736     }
   737 
   737 
   792                           QIcon::Mode mode,
   792                           QIcon::Mode mode,
   793                           QIcon::State state )
   793                           QIcon::State state )
   794 {
   794 {
   795     // This method is called by QIcon and it should paint the icon with the size defined by 'rect'.
   795     // This method is called by QIcon and it should paint the icon with the size defined by 'rect'.
   796     HbIconImpl* icon =  NULL;
   796     HbIconImpl* icon =  NULL;
       
   797     
       
   798     // update the rendering mode
       
   799     HbIconLoader::global()->updateRenderingMode(painter->paintEngine()->type());
       
   800     
   797     icon = paintHelper(rect.size(), Qt::KeepAspectRatio, mode, state);
   801     icon = paintHelper(rect.size(), Qt::KeepAspectRatio, mode, state);
   798     if (icon){
   802     if (icon){
   799         icon->paint(painter, rect, Qt::AlignCenter);
   803         icon->paint(painter, rect, Qt::AlignCenter);
   800         HbIconLoader *loader = HbIconLoader::global();
   804         HbIconLoader::global()->unLoadIcon(icon);
   801         loader->unLoadIcon(icon);
       
   802         icon->dispose();
   805         icon->dispose();
   803     }
   806     }
   804 
   807 
   805     // Now paint any necessary badges.
   808     // Now paint any necessary badges.
   806     if (d->badgeInfo) {
   809     if (d->badgeInfo) {
   853         d->aspectRatioMode = aspectRatioMode;
   856         d->aspectRatioMode = aspectRatioMode;
   854         d->mode = mode;
   857         d->mode = mode;
   855         d->state = state;
   858         d->state = state;
   856         // If icon parameters changed unload the icon first, and get the new icon
   859         // If icon parameters changed unload the icon first, and get the new icon
   857         d->unLoadIcon();
   860         d->unLoadIcon();
       
   861         // Update the rendering mode
       
   862         HbIconLoader::global()->updateRenderingMode(painter->paintEngine()->type());        
   858         d->icon = paintHelper(s, aspectRatioMode, mode, state);
   863         d->icon = paintHelper(s, aspectRatioMode, mode, state);
   859         if ( d->icon && d->icon->isCreatedOnServer() ) {
   864         if ( d->icon && d->icon->isCreatedOnServer() ) {
   860             d->iconType = d->icon->iconData().type;
   865             d->iconType = d->icon->iconData().type;
   861         }
   866         }
   862     }
   867     }