uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp
branchRCL_3
changeset 3 d8a3531bc6b8
parent 0 15bf7259bb7c
child 5 433cbbb6a04b
equal deleted inserted replaced
0:15bf7259bb7c 3:d8a3531bc6b8
    44 #include "uiacceltk/huitextstylemanager.h"
    44 #include "uiacceltk/huitextstylemanager.h"
    45 #include "huistatictlsdata.h"
    45 #include "huistatictlsdata.h"
    46 #include "uiacceltk/HuiThemeManager.h"
    46 #include "uiacceltk/HuiThemeManager.h"
    47 #include "huicanvastexturecache.h"
    47 #include "huicanvastexturecache.h"
    48 #include "HuiFxEngine.h"
    48 #include "HuiFxEngine.h"
       
    49 
       
    50 #include "huisynchronizationobserver.h"
    49 
    51 
    50 #define HUI_HIRES_TIMER
    52 #define HUI_HIRES_TIMER
    51 
    53 
    52 
    54 
    53 /* Constants */
    55 /* Constants */
  1067             iFrames = 0;
  1069             iFrames = 0;
  1068             iMillisecondFromFPSUpdate = 0;
  1070             iMillisecondFromFPSUpdate = 0;
  1069             }
  1071             }
  1070         }
  1072         }
  1071 
  1073 
       
  1074     DoSynchronize();
       
  1075         
  1072     iCurrentDisplay = NULL; // informs the egosystem that the drawing is done.
  1076     iCurrentDisplay = NULL; // informs the egosystem that the drawing is done.
  1073     CHuiStatic::ReportNewFrame();
  1077     CHuiStatic::ReportNewFrame();
  1074     
  1078     
  1075     // Store cpu value conters of null thread. Values will be used at the start of the next frame.
  1079     // Store cpu value conters of null thread. Values will be used at the start of the next frame.
  1076     if (iIdleCPUValueMonitored)
  1080     if (iIdleCPUValueMonitored)
  1760 
  1764 
  1761 EXPORT_C THuiMemoryLevel CHuiEnv::MemoryLevel()
  1765 EXPORT_C THuiMemoryLevel CHuiEnv::MemoryLevel()
  1762     {
  1766     {
  1763     return iMemoryLevel;
  1767     return iMemoryLevel;
  1764     }
  1768     }
       
  1769 
       
  1770 EXPORT_C void CHuiEnv::Synchronize(TInt aId, MHuiSynchronizationObserver* aObserver)
       
  1771     {
       
  1772     iSynchObserver = aObserver;
       
  1773     iSynchId = aId;
       
  1774     
       
  1775     if ( aObserver )
       
  1776         {
       
  1777         ContinueRefresh();
       
  1778         }
       
  1779     }
       
  1780 
       
  1781 void CHuiEnv::DoSynchronize()
       
  1782     {
       
  1783     if ( !iSynchObserver )
       
  1784         {
       
  1785         return;
       
  1786         }
       
  1787 
       
  1788     // Synchronize commands before signalling through P&S
       
  1789     for(TInt i = 0; i < iDisplays.Count(); ++i)
       
  1790         {          
       
  1791         if ( ( iDisplays[i]->DisplayType() != CHuiDisplay::EDisplayOffScreenBuffer ) 
       
  1792              && ( iDisplays[i]->ScreenBufferObserver() == NULL ) )
       
  1793             {
       
  1794             MakeCurrent(*iDisplays[i]);
       
  1795             iDisplays[i]->RenderSurface().Finish();
       
  1796             }
       
  1797         }
       
  1798 
       
  1799     iSynchObserver->Synchronized( iSynchId );
       
  1800     iSynchObserver = NULL;
       
  1801     }
       
  1802 
       
  1803 void CHuiEnv::RemoveTheControlGroup(TInt aId)
       
  1804     {
       
  1805     TInt i;
       
  1806 
       
  1807     for(i = 0; i < iLoadedGroups.Count(); ++i)
       
  1808         {
       
  1809         if(iLoadedGroups[i]->ResourceId() == aId)
       
  1810             {
       
  1811             // This is control group to delete.
       
  1812             CHuiControlGroup* group = iLoadedGroups[i];
       
  1813             CancelCommands(group);
       
  1814 
       
  1815             for (TInt ii = iDisplays.Count()-1; ii>=0; ii--)
       
  1816                 {
       
  1817                 TInt index = iDisplays[ii]->Roster().Find(group);
       
  1818                 if (index != KErrNotFound)
       
  1819                     {
       
  1820                     iDisplays[ii]->Roster().Hide(iDisplays[ii]->Roster().ControlGroup(index));
       
  1821                     }
       
  1822                 }
       
  1823             
       
  1824             iLoadedGroups.Remove(i);
       
  1825             
       
  1826             }
       
  1827         }
       
  1828 
       
  1829    
       
  1830     }