uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp
branchRCL_3
changeset 34 3a60ebea00d0
parent 24 f93c875b566e
child 63 e1987ab3768a
equal deleted inserted replaced
24:f93c875b566e 34:3a60ebea00d0
  1904 
  1904 
  1905     // If render buffer is used, draw its content to display here
  1905     // If render buffer is used, draw its content to display here
  1906     if (aUpdateDisplay && renderbuffer && iCanvasGc->Gc())
  1906     if (aUpdateDisplay && renderbuffer && iCanvasGc->Gc())
  1907         {
  1907         {
  1908         THuiRealRect updatedRect = aUpdateRegion.BoundingRect();
  1908         THuiRealRect updatedRect = aUpdateRegion.BoundingRect();
  1909 				  TInt w; 
  1909         TInt w = 0; 
  1910 				  TInt h ;
  1910 		TInt h = 0;
  1911         // Handle relative rotation
  1911         // Handle relative rotation
  1912         if (iVisual->Display())
  1912         if (iVisual->Display())
  1913             {
  1913             {
  1914             TRect displayArea = iVisual->Display()->VisibleArea();
  1914             TRect displayArea = iVisual->Display()->VisibleArea();
  1915             w = displayArea.Width();
  1915             w = displayArea.Width();
  2134         {    
  2134         {    
  2135         gc->PopClip();
  2135         gc->PopClip();
  2136         }
  2136         }
  2137     }
  2137     }
  2138 
  2138 
       
  2139 static TRect CalculateClipRect(CHuiCanvasRenderBuffer* aRenderbuffer)
       
  2140     {
       
  2141     const TInt KHuiDefaultSize = 2048;
       
  2142     return 
       
  2143         aRenderbuffer && aRenderbuffer->IsInitialized() ? 
       
  2144         TRect( aRenderbuffer->Size() ) :
       
  2145         TRect( TSize( KHuiDefaultSize, KHuiDefaultSize ) );
       
  2146     }
       
  2147 
  2139 void CHuiCanvasWsHwGc::BindRenderBuffer(CHuiCanvasRenderBuffer* aRenderbuffer, const TRegion& aUpdateRegion)
  2148 void CHuiCanvasWsHwGc::BindRenderBuffer(CHuiCanvasRenderBuffer* aRenderbuffer, const TRegion& aUpdateRegion)
  2140     {
  2149     {
  2141     // Disable effective opacity when rendering to a buffer
  2150     // Disable effective opacity when rendering to a buffer
  2142     iCanvasGc->EnableEffectiveOpacity(EFalse);
  2151     iCanvasGc->EnableEffectiveOpacity(EFalse);
  2143     
  2152     
  2156     // Push clipping so that we can restore it after we have done drawing into render buffer.
  2165     // Push clipping so that we can restore it after we have done drawing into render buffer.
  2157     iCanvasGc->Gc()->PushClip();
  2166     iCanvasGc->Gc()->PushClip();
  2158     
  2167     
  2159     // Set new clipping region which does not clip anything. 
  2168     // Set new clipping region which does not clip anything. 
  2160     // We want always draw aUpdateRegion fully to the aRenderbuffer. 
  2169     // We want always draw aUpdateRegion fully to the aRenderbuffer. 
  2161     TRect displayArea = iCanvasGc->Gc()->DisplayArea(); 
  2170             
  2162     
  2171     iCanvasGc->Gc()->SetClip(CalculateClipRect(aRenderbuffer)); // this call does not transform region anymore
  2163     iCanvasGc->Gc()->SetClip(displayArea); // this call does not transform region anymore
       
  2164     
  2172     
  2165     // We use translation to get screen coordinates to match render buffer coordinates
  2173     // We use translation to get screen coordinates to match render buffer coordinates
  2166     iCanvasGc->PushTransformationMatrix();
  2174     iCanvasGc->PushTransformationMatrix();
  2167     iCanvasGc->Translate(x, y, 0.f);
  2175     iCanvasGc->Translate(x, y, 0.f);
  2168         
  2176         
  2169     // Handle relative rotation
  2177     // Handle relative rotation
       
  2178     TRect displayArea = iCanvasGc->Gc()->DisplayArea();
  2170     TInt w = displayArea.Width();
  2179     TInt w = displayArea.Width();
  2171     TInt h = displayArea.Height();
  2180     TInt h = displayArea.Height();
  2172     
  2181     
  2173     // ...select right rotation...
  2182     // ...select right rotation...
  2174     if (iRelativeOrientation == CHuiGc::EOrientationCW90)
  2183     if (iRelativeOrientation == CHuiGc::EOrientationCW90)