uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp
changeset 31 1b6909418757
parent 29 ac3859d43844
equal deleted inserted replaced
30:920e03da86f0 31:1b6909418757
    42 #include <graphics/wsgraphicscontext.h>
    42 #include <graphics/wsgraphicscontext.h>
    43 
    43 
    44 #ifdef HUI_DEBUG_TRACK_DRAWING
    44 #ifdef HUI_DEBUG_TRACK_DRAWING
    45 #include "alfloggingconfiguration.h"
    45 #include "alfloggingconfiguration.h"
    46 #include "alfcommanddebug.h"
    46 #include "alfcommanddebug.h"
       
    47 #include "huistatictlsdata.h"
    47 #endif
    48 #endif
    48 #include <e32cmn.h>
    49 #include <e32cmn.h>
    49 #include <AknLayoutFont.h>
    50 #include <AknLayoutFont.h>
    50 #include <graphics/lookuptable.h>
    51 #include <graphics/lookuptable.h>
    51 
    52 
   124     else
   125     else
   125         {
   126         {
   126         // Never happens, right.
   127         // Never happens, right.
   127         }
   128         }
   128     
   129     
   129     iWsCommandBufferReader = new (ELeave) CHuiCanvasCmdBufferReader();    
   130     iWsCommandBufferReader = new (ELeave) CHuiCanvasCmdBufferReader(); 
   130 #ifdef HUI_DEBUG_TRACK_DRAWING
   131     
   131     iCommandDebugger = CAlfCommandDebug::NewL();
   132     #ifdef HUI_DEBUG_TRACK_DRAWING
   132     CHuiCanvasWsGc* realGc = iCanvasWsGc;
   133     if (!iCanvasDebugWsGc)
   133     iCanvasWsGc = CHuiCanvasDebugWsGc::NewL( realGc, *iCommandDebugger );
   134         {
   134     
   135         iCanvasDebugWsGc = CHuiCanvasDebugWsGc::NewL( iCanvasWsGc, *TTlsData::CommandDebugger() );
   135 #endif
   136         iCanvasWsGc = iCanvasDebugWsGc;
       
   137         }
       
   138     
       
   139     #endif
   136     }
   140     }
   137 
   141 
   138 
   142 
   139 CHuiCanvasWsPainter::~CHuiCanvasWsPainter()
   143 CHuiCanvasWsPainter::~CHuiCanvasWsPainter()
   140     {
   144     {
   155 
   159 
   156     iTempRegion.Close();
   160     iTempRegion.Close();
   157     iTempCurrentSubRegion.Close();
   161     iTempCurrentSubRegion.Close();
   158     iTempIntersectingRegion.Close();
   162     iTempIntersectingRegion.Close();
   159 #ifdef HUI_DEBUG_TRACK_DRAWING
   163 #ifdef HUI_DEBUG_TRACK_DRAWING
   160     delete iCommandDebugger;
   164     delete iCanvasDebugWsGc;
   161 #endif
   165 #endif
   162     iFullUpdateRegion.Close();
   166     iFullUpdateRegion.Close();
   163     iShapeRegion.Close();
   167     iShapeRegion.Close();
   164     }
   168     }
   165     
   169     
   564                 continue;
   568                 continue;
   565                 }
   569                 }
   566             
   570             
   567             // Clip drawing to update area. This seems to improve performance although
   571             // Clip drawing to update area. This seems to improve performance although
   568             // it may depend on used HW.
   572             // it may depend on used HW.
       
   573 
       
   574             // Set position delta to zero, otherwise updateregion is adjusted incorrectly
       
   575             // in SW mode. No effect on HW mode as it does not adjust the updateregion in
       
   576             // EnableUpdateRegion call...
       
   577             TPoint delta(0,0);
       
   578             iCanvasWsGc->SetPositionDelta(delta);
   569             iCanvasWsGc->EnableUpdateRegion(iCommandBuffers[cb]->iUpdateRegion, aClearBeforeHandlingBuffers);
   579             iCanvasWsGc->EnableUpdateRegion(iCommandBuffers[cb]->iUpdateRegion, aClearBeforeHandlingBuffers);
   570 
   580 
   571             #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL
   581             #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL
   572             RDebug::Print(_L(">> CHuiCanvasWsPainter::DoHandleAllBuffersL ClipRegion after clipping to updateregion:"));                
   582             RDebug::Print(_L(">> CHuiCanvasWsPainter::DoHandleAllBuffersL ClipRegion after clipping to updateregion:"));                
   573             const TRegion& clipregion = aGc->ClipRegion(); 
   583             const TRegion& clipregion = aGc->ClipRegion(); 
   759                 }
   769                 }
   760             default:;
   770             default:;
   761             }
   771             }
   762         }
   772         }
   763 
   773 
   764     iCommandDebugger->StartFrame();
   774     TTlsData::CommandDebugger()->StartFrame();
   765     if ( commandBuffer->iProcessName )
   775     if ( commandBuffer->iProcessName )
   766         {
   776         {
   767         // UNCOMMENT THIS IF YOU WANT TO PRINT EVERYTHING
   777         // UNCOMMENT THIS IF YOU WANT TO PRINT EVERYTHING
   768         // iCommandDebugger->SetPrint( ETrue );
   778         // iCommandDebugger->SetPrint( ETrue );
   769         // UNCOMMENT THIS IF YOU WANT PRINTS ONLY FOR CERTAIN PROCESS!
   779         // UNCOMMENT THIS IF YOU WANT PRINTS ONLY FOR CERTAIN PROCESS!
   795     TInt command = 0;
   805     TInt command = 0;
   796     do
   806     do
   797         {
   807         {
   798         command = readerStream.ReadUint8L();
   808         command = readerStream.ReadUint8L();
   799 #ifdef HUI_DEBUG_TRACK_DRAWING
   809 #ifdef HUI_DEBUG_TRACK_DRAWING
   800         iCommandDebugger->SetDescription( command );
   810         TTlsData::CommandDebugger()->SetDescription( command );
   801 #endif
   811 #endif
   802 
   812 
   803 		// Command cases are ordered approximately in the order so that most common ones are at first
   813 		// Command cases are ordered approximately in the order so that most common ones are at first
   804         switch ( command )
   814         switch ( command )
   805             {
   815             {
  1284             }// end switch
  1294             }// end switch
  1285     		offset = readerStream.Source()->TellL( MStreamBuf::ERead ).Offset();
  1295     		offset = readerStream.Source()->TellL( MStreamBuf::ERead ).Offset();
  1286        	
  1296        	
  1287         } while( offset < bufLength );
  1297         } while( offset < bufLength );
  1288 #ifdef HUI_DEBUG_TRACK_DRAWING
  1298 #ifdef HUI_DEBUG_TRACK_DRAWING
  1289     iCommandDebugger->EndFrame();
  1299     TTlsData::CommandDebugger()->EndFrame();
  1290 #endif    
  1300 #endif    
  1291     }
  1301     }
  1292     
  1302     
  1293     
  1303     
  1294 void CHuiCanvasWsPainter::SetCommandSetL( const TDesC8& aCommands )
  1304 void CHuiCanvasWsPainter::SetCommandSetL( const TDesC8& aCommands )
  2138     iTempRegion.Clear();                
  2148     iTempRegion.Clear();                
  2139     iWsCommandBufferReader->ReadRegionL( iTempRegion );
  2149     iWsCommandBufferReader->ReadRegionL( iTempRegion );
  2140     if (aIndex==-1) return; //TP
  2150     if (aIndex==-1) return; //TP
  2141     // Update region is modified when new buffers are added after this buffer, 
  2151     // Update region is modified when new buffers are added after this buffer, 
  2142     // so store the region only at first read. 
  2152     // so store the region only at first read. 
  2143     if (iCommandBuffers[aIndex]->iChanged && iCommandBuffers[aIndex]->iUpdateRegion.Count() == 0)
  2153     if (iCommandBuffers[aIndex]->iChanged && iCommandBuffers[aIndex]->iOriginalUpdateRegion.Count() == 0)
  2144         {
  2154         {
  2145         // Check first that the coordiates are not insane (sometimes thay are)
  2155         // Check first that the coordiates are not insane (sometimes thay are)
  2146         TInt count = iTempRegion.Count();                    
  2156         TInt count = iTempRegion.Count();                    
  2147         TRect displayRect = iCanvasVisual->DisplayRect();
  2157         TRect displayRect = iCanvasVisual->DisplayRect();
  2148         for (TInt i=count-1; i>=0; i--)
  2158         for (TInt i=count-1; i>=0; i--)
  2750         // Forward 'enable render buffer' setting to new GC.
  2760         // Forward 'enable render buffer' setting to new GC.
  2751         iCanvasWsGc->EnableRenderbuffer( iEnableRenderBuffer );
  2761         iCanvasWsGc->EnableRenderbuffer( iEnableRenderBuffer );
  2752         }
  2762         }
  2753 
  2763 
  2754     #ifdef HUI_DEBUG_TRACK_DRAWING
  2764     #ifdef HUI_DEBUG_TRACK_DRAWING
  2755     CHuiCanvasWsGc* realGc = iCanvasWsGc;
  2765     if (!iCanvasDebugWsGc)
  2756     iCanvasWsGc = CHuiCanvasDebugWsGc::NewL( realGc, *iCommandDebugger );
  2766         {
       
  2767         iCanvasDebugWsGc = CHuiCanvasDebugWsGc::NewL( iCanvasWsGc, *TTlsData::CommandDebugger() );
       
  2768         }
       
  2769     else if(iCanvasWsGc!=iCanvasDebugWsGc) 
       
  2770         {
       
  2771         iCanvasDebugWsGc->SetInternalGc(iCanvasWsGc);
       
  2772         }
       
  2773     
       
  2774     iCanvasWsGc = iCanvasDebugWsGc;
  2757     #endif
  2775     #endif
  2758     
  2776     
  2759     AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC();
  2777     AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC();
  2760     }
  2778     }
  2761 
  2779