webengine/webkitutils/HistoryProvider/HistoryView.cpp
branchRCL_3
changeset 44 800203832575
parent 37 ac77f89b1d9e
child 48 79859ed3eea9
equal deleted inserted replaced
42:a1a5d4e727e8 44:800203832575
    46 const int KMinAnimFactor = 0;
    46 const int KMinAnimFactor = 0;
    47 const int KMinimumScroll = 20;
    47 const int KMinimumScroll = 20;
    48 
    48 
    49 #define KCenterImageBorderColor TRgb(179,179,181)
    49 #define KCenterImageBorderColor TRgb(179,179,181)
    50 #define KSideImageBorderColor KRgbBlack
    50 #define KSideImageBorderColor KRgbBlack
    51 #define KSideImageMaskColor TRgb( 170, 170, 170, 150 )
    51 #define KSideImageMaskColor TRgb(170, 170, 170)
    52 
    52 
    53 // ============================= LOCAL FUNCTIONS ===============================
    53 // ============================= LOCAL FUNCTIONS ===============================
    54 
    54 
    55 TBool animRepaint(TAny* aAny)
    55 TBool animRepaint(TAny* aAny)
    56 {
    56 {
   140     delete m_repaintTimer;
   140     delete m_repaintTimer;
   141     if (m_autoScrollPeriodic) {
   141     if (m_autoScrollPeriodic) {
   142         m_autoScrollPeriodic->Cancel();
   142         m_autoScrollPeriodic->Cancel();
   143         delete m_autoScrollPeriodic;
   143         delete m_autoScrollPeriodic;
   144     }
   144     }
       
   145     delete m_maskBitmap;
   145 }
   146 }
   146 
   147 
   147 bool HistoryView::calcRepaintRect()
   148 bool HistoryView::calcRepaintRect()
   148 {
   149 {
   149     if (m_resizeFactor == KMaxAnimFactor) {
   150     if (m_resizeFactor == KMaxAnimFactor) {
   283     if (leftEntry) {
   284     if (leftEntry) {
   284         if (!leftEntry->thumbnail()) {
   285         if (!leftEntry->thumbnail()) {
   285             TRAP_IGNORE(leftEntry->constructThumbnailL());
   286             TRAP_IGNORE(leftEntry->constructThumbnailL());
   286         }
   287         }
   287         if (leftEntry->thumbnail()) {
   288         if (leftEntry->thumbnail()) {
   288             m_bitmapContext->BitBlt( m_leftPlaceHolderRect.iTl, leftEntry->thumbnail(), TRect(TPoint(0,0), m_leftPlaceHolderRect.Size()) );
   289             if(!m_maskBitmap) {
   289         }
   290                 TSize maskBitmapSize(m_leftPlaceHolderRect.Size());
   290         
   291                 TRAP_IGNORE(CreateMaskBitmapForLeftRightThumbnailL(maskBitmapSize, EGray256, KSideImageMaskColor));
   291         m_bitmapContext->SetBrushColor ( KSideImageMaskColor );
   292             }
   292         m_bitmapContext->SetBrushStyle ( CWindowGc::ESolidBrush );
   293             if(m_maskBitmap) {
   293         m_bitmapContext->DrawRect(m_leftPlaceHolderRect);
   294                 m_bitmapContext->BitBltMasked(m_leftPlaceHolderRect.iTl, leftEntry->thumbnail(), TRect(TPoint(0,0), m_leftPlaceHolderRect.Size()), m_maskBitmap, EFalse);
   294         m_bitmapContext->SetBrushStyle(CGraphicsContext::ENullBrush);
   295             }
       
   296             else {
       
   297                 //if failed to create a mask, just draw the left entry thumbnail.
       
   298                 m_bitmapContext->BitBlt( m_leftPlaceHolderRect.iTl, leftEntry->thumbnail(), TRect(TPoint(0,0), m_leftPlaceHolderRect.Size()) );
       
   299             }
       
   300         }
   295     }
   301     }
   296     // updateDisplay the next thumbnail
   302     // updateDisplay the next thumbnail
   297     if (rightEntry) {
   303     if (rightEntry) {
   298         if (!rightEntry->thumbnail()) {
   304         if (!rightEntry->thumbnail()) {
   299             TRAP_IGNORE(rightEntry->constructThumbnailL());
   305             TRAP_IGNORE(rightEntry->constructThumbnailL());
   300         }
   306         }
   301         if (rightEntry->thumbnail()) {
   307         if (rightEntry->thumbnail()) {
   302             m_bitmapContext->BitBlt( m_rightPlaceHolderRect.iTl, rightEntry->thumbnail(), TRect(TPoint(0,0), m_rightPlaceHolderRect.Size()) );
   308             if(!m_maskBitmap) {
   303         }
   309                 TSize maskBitmapSize(m_rightPlaceHolderRect.Size());
   304         
   310                 TRAP_IGNORE(CreateMaskBitmapForLeftRightThumbnailL(maskBitmapSize, EGray256, KSideImageMaskColor));
   305         m_bitmapContext->SetBrushColor ( KSideImageMaskColor );
   311             }
   306         m_bitmapContext->SetBrushStyle ( CWindowGc::ESolidBrush );
   312             if(m_maskBitmap) {
   307         m_bitmapContext->DrawRect(m_rightPlaceHolderRect);
   313                 m_bitmapContext->BitBltMasked(m_rightPlaceHolderRect.iTl, rightEntry->thumbnail(), TRect(TPoint(0,0), m_rightPlaceHolderRect.Size()), m_maskBitmap, EFalse);
   308         m_bitmapContext->SetBrushStyle(CGraphicsContext::ENullBrush);
   314             }
       
   315             else {
       
   316                 //if failed to create a mask, just draw the right entry thumbnail.
       
   317                 m_bitmapContext->BitBlt( m_rightPlaceHolderRect.iTl, rightEntry->thumbnail(), TRect(TPoint(0,0), m_rightPlaceHolderRect.Size()) );
       
   318             }
       
   319         }
   309     }
   320     }
   310     // updateDisplay the center thumbnail
   321     // updateDisplay the center thumbnail
   311     if (m_centerEntry ) {
   322     if (m_centerEntry ) {
   312         if (!m_centerEntry->thumbnail()) {
   323         if (!m_centerEntry->thumbnail()) {
   313             TRAP_IGNORE(m_centerEntry->constructThumbnailL());
   324             TRAP_IGNORE(m_centerEntry->constructThumbnailL());
   828             m_historyController->historyCallback()->navigationStateChanged(TBrCtlDefs::EStateHistoryEnd, false);
   839             m_historyController->historyCallback()->navigationStateChanged(TBrCtlDefs::EStateHistoryEnd, false);
   829         }
   840         }
   830 
   841 
   831     }
   842     }
   832 }
   843 }
       
   844 
       
   845 void HistoryView::CreateMaskBitmapForLeftRightThumbnailL(TSize& aSize, TDisplayMode aDisplayMode, TRgb aRgb)
       
   846 {
       
   847     if(m_maskBitmap) {
       
   848         delete m_maskBitmap;
       
   849         m_maskBitmap = NULL;
       
   850     }
       
   851     m_maskBitmap = new (ELeave) CFbsBitmap();
       
   852     User::LeaveIfError(m_maskBitmap->Create(aSize, aDisplayMode));
       
   853     CFbsBitmapDevice* maskBitmapDevice = CFbsBitmapDevice::NewL(m_maskBitmap);
       
   854     CFbsBitGc* maskBitmapContext;
       
   855     User::LeaveIfError(maskBitmapDevice->CreateContext(maskBitmapContext));
       
   856     maskBitmapContext->SetPenStyle( CGraphicsContext::ENullPen );
       
   857     maskBitmapContext->SetBrushColor( aRgb );
       
   858     maskBitmapContext->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   859     maskBitmapContext->DrawRect(TRect(TPoint(0,0), m_maskBitmap->SizeInPixels()));
       
   860     delete maskBitmapContext;
       
   861     delete maskBitmapDevice;
       
   862 }
   833 //  End of File
   863 //  End of File