messagingappbase/msgeditor/mediacontrolsrc/MsgImageControl.cpp
branchRCL_3
changeset 77 da6ac9d688df
parent 66 fc3320e39880
equal deleted inserted replaced
71:17302fa075e1 77:da6ac9d688df
   148     
   148     
   149     iDestinationBitmap = IHLBitmap::CreateL();
   149     iDestinationBitmap = IHLBitmap::CreateL();
   150             
   150             
   151     TSize sourceSize( iSourceImage->Size() );
   151     TSize sourceSize( iSourceImage->Size() );
   152     TSize targetSize = TSize(
   152     TSize targetSize = TSize(
   153     	Min( sourceSize.iWidth, iMaxSize.iWidth - iFrame->FrameBorderSize().iWidth ),
   153     Min( sourceSize.iWidth, iMaxSize.iWidth - iFrame->FrameBorderSize().iWidth ),
   154 		Min( sourceSize.iHeight, iMaxSize.iHeight - iFrame->FrameBorderSize().iHeight ) );
   154     Min( sourceSize.iHeight, iMaxSize.iHeight - iFrame->FrameBorderSize().iHeight ) );
   155 
   155 
   156     // In case of KImageTypePNGUid and KImageTypeBMPUid 
   156     // Avoiding the usage of MIHLImageViewer::EOptionUseBilinearInterpolation
   157     // with and without IsAnimation, call CreateImageViewerL with
   157     // because it should be only used for small images because of the memory requirements
   158     // Flags zero. This to avoid image corruption  when IsAnimation is flase and 
   158     // and it is much slower than the regular scaling
   159     // Image resize happened based on control size.
   159     //For any type of image, nearest neighbour method(default) will be used to resize it. 
   160 
   160     
   161     TUint32 flagOptions = 0;
   161     iEngine = IHLViewerFactory::CreateImageViewerL( targetSize,
   162     
       
   163     if ( !iSourceImage->IsAnimation() &&
       
   164            iSourceImage->ImageType() == KImageTypeGIFUid )
       
   165         {
       
   166         	flagOptions |= MIHLImageViewer::EOptionUseBilinearInterpolation;
       
   167       	}
       
   168  	  iEngine = IHLViewerFactory::CreateImageViewerL( targetSize,
       
   169                                                     *iSourceImage, 
   162                                                     *iSourceImage, 
   170                                                     *iDestinationBitmap, 
   163                                                     *iDestinationBitmap, 
   171                                                     *this, 
   164                                                     *this);                        	
   172                                                     flagOptions);                        	
       
   173     }
   165     }
   174 
   166 
   175 // ---------------------------------------------------------
   167 // ---------------------------------------------------------
   176 // CMsgImageControl::Cancel
   168 // CMsgImageControl::Cancel
   177 // ---------------------------------------------------------
   169 // ---------------------------------------------------------