uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp
branchRCL_3
changeset 13 3a60ebea00d0
parent 12 f93c875b566e
child 15 cd0ae4656946
equal deleted inserted replaced
12:f93c875b566e 13:3a60ebea00d0
    47 #include <coecntrl.h>
    47 #include <coecntrl.h>
    48 #include <uiacceltk/huidisplaybackgrounditem.h>
    48 #include <uiacceltk/huidisplaybackgrounditem.h>
    49 #include "huiskinbackroundlayout.h"
    49 #include "huiskinbackroundlayout.h"
    50 #include "HuiFxEngine.h"
    50 #include "HuiFxEngine.h"
    51 #include "huiextension.h"
    51 #include "huiextension.h"
       
    52 
       
    53 #include <e32math.h>
       
    54 
       
    55 //#define DEBUG_SW_MODE_DIRTY_AREAS
    52 
    56 
    53 const TUid KHuiInternalFbsBitmapBufferGcUid = {0x2000e5a3}; 
    57 const TUid KHuiInternalFbsBitmapBufferGcUid = {0x2000e5a3}; 
    54 
    58 
    55 //#define HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL
    59 //#define HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL
    56 
    60 
   882     for(; iCurrentDirtyIndx < iTempDirtyRegions.Count(); ++iCurrentDirtyIndx)
   886     for(; iCurrentDirtyIndx < iTempDirtyRegions.Count(); ++iCurrentDirtyIndx)
   883         {
   887         {
   884         // Set up the clipping rectangle.
   888         // Set up the clipping rectangle.
   885         TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx];
   889         TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx];
   886         ClipDirtyRect(dirtyRect, VisibleAreaClippingRect());
   890         ClipDirtyRect(dirtyRect, VisibleAreaClippingRect());
   887         
   891         iCurrentDirtyRect = dirtyRect;
   888         iGc->PushClip();
   892         iGc->PushClip();
   889         iGc->Clip(dirtyRect);        
   893         iGc->Clip(dirtyRect);        
   890         
   894         
   891         if ( iForegroundBitmapGc && !RosterImpl().IsVisibleContentFrozen() )
   895         if ( iForegroundBitmapGc && !RosterImpl().IsVisibleContentFrozen() )
   892             {
   896             {
   912                     
   916                     
   913 	        iForegroundBitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
   917 	        iForegroundBitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
   914             iForegroundBitmapGc->SetPenColor(clearColor);
   918             iForegroundBitmapGc->SetPenColor(clearColor);
   915             iForegroundBitmapGc->SetBrushColor(clearColor);
   919             iForegroundBitmapGc->SetBrushColor(clearColor);
   916             iForegroundBitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   920             iForegroundBitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   917   	        iForegroundBitmapGc->Clear();
   921   	        iForegroundBitmapGc->Clear(dirtyRect);
   918   	        iForegroundBitmapGc->Reset();
   922   	        iForegroundBitmapGc->Reset();
   919             }
   923             }
   920         		
   924         		
   921         for(TInt i = 0; i < iRosterObservers.Count(); i++)
   925         for(TInt i = 0; i < iRosterObservers.Count(); i++)
   922             {
   926             {
   973     	iCurrentDirtyRegions = tmp;
   977     	iCurrentDirtyRegions = tmp;
   974 		}
   978 		}
   975 		
   979 		
   976 	// Clear current dirty regions	
   980 	// Clear current dirty regions	
   977 	iCurrentDirtyRegions->Reset();
   981 	iCurrentDirtyRegions->Reset();
   978 	
   982 		    	
   979 	// Trick to swap gles buffers if we are drawing idle screens before refresh loop is going to
       
   980 	// sleep. 
       
   981 	if(	IsRendererHWAccelerated() && !iGotDirtyReports && !iScreenBufferObserver) 
       
   982     		{
       
   983 	    	//RenderSurface().SwapBuffers(); [ohi]
       
   984 	    	}
       
   985 	    	
       
   986 	// Tell the screen buffer observer that the buffer is complete 
       
   987 	if(iScreenBufferObserver)
       
   988 		{
       
   989 		SetScreenBufferLock(ETrue); // the observer should do unlock!
       
   990 		
       
   991 		TRect rect(VisibleArea()); // This is not the real display rect in ALF display case(!)
       
   992 		TRect dirtyRect(mergedDirtyRect);
       
   993 		
       
   994 		// Update screen buffer GC bitmap
       
   995 		if (DisplayType() != CHuiDisplay::EDisplayOffScreenBuffer)
       
   996 			{
       
   997 			TRAP_IGNORE(CHuiStatic::Renderer().UpdateOffScreenBitmapL(*this));			
       
   998 			}
       
   999 						
       
  1000 		if (iScreenBufferObserver->ScreenBufferComplete(iScreenBufferUid, rect, dirtyRect))
       
  1001 			{
       
  1002 			SetScreenBufferLock(EFalse);
       
  1003 			}
       
  1004 		}
       
  1005 
       
  1006     iWholeDisplayAreaIsDirty = EFalse;    
   983     iWholeDisplayAreaIsDirty = EFalse;    
  1007 	
   984 	
  1008     HUI_PROBE_PROGRAMFLOW_EXIT(MHuiProbe::EProgramFlowPointRefresh)
   985     HUI_PROBE_PROGRAMFLOW_EXIT(MHuiProbe::EProgramFlowPointRefresh)
  1009     HUI_DEBUGF(_L("CHuiDisplay::Refresh() - Exiting."));
   986     HUI_DEBUGF(_L("CHuiDisplay::Refresh() - Exiting."));
  1010 
   987 
  1669 
  1646 
  1670 void CHuiDisplay::UpdateForegroundTexture(const TRect& aRect)
  1647 void CHuiDisplay::UpdateForegroundTexture(const TRect& aRect)
  1671     {
  1648     {
  1672     if (iForegroundTexture && iForegroundBitmap && !aRect.IsEmpty())
  1649     if (iForegroundTexture && iForegroundBitmap && !aRect.IsEmpty())
  1673         {
  1650         {
       
  1651 #if defined(DEBUG_SW_MODE_DIRTY_AREAS)
       
  1652         TRgb penColor = TRgb(Math::Random());
       
  1653         penColor.SetAlpha(128);
       
  1654         iForegroundBitmapGc->SetPenStyle(CGraphicsContext::ESolidPen);
       
  1655         iForegroundBitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  1656         iForegroundBitmapGc->SetPenColor(penColor);
       
  1657         iForegroundBitmapGc->SetBrushColor(penColor);
       
  1658         iForegroundBitmapGc->DrawRect(aRect);
       
  1659 #endif
  1674         TRAP_IGNORE(DoUpdateForegroundTextureL(aRect));
  1660         TRAP_IGNORE(DoUpdateForegroundTextureL(aRect));
  1675         }
  1661         }
  1676     }
  1662     }
  1677 
  1663 
  1678 void CHuiDisplay::DoUpdateForegroundTextureL(const TRect& aRect)
  1664 void CHuiDisplay::DoUpdateForegroundTextureL(const TRect& aRect)
  1820                 }                                                
  1806                 }                                                
  1821             }                                    
  1807             }                                    
  1822         }
  1808         }
  1823     }
  1809     }
  1824 
  1810 
       
  1811 TRect CHuiDisplay::CurrentDirtyRect()
       
  1812     {
       
  1813     return iCurrentDirtyRect;
       
  1814     }