uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp
branchRCL_3
changeset 18 1801340c26a2
parent 17 c9d868f1e20c
child 19 e5af45d51884
equal deleted inserted replaced
17:c9d868f1e20c 18:1801340c26a2
   288         Env().CanvasTextureCache().EnableTouchCountCheck();
   288         Env().CanvasTextureCache().EnableTouchCountCheck();
   289         }
   289         }
   290         
   290         
   291     if (iCanvasVisualData->iCommandSetType == ECommandBufferWs || iCanvasVisualData->iCommandSetType == ECommandBufferAlf)
   291     if (iCanvasVisualData->iCommandSetType == ECommandBufferWs || iCanvasVisualData->iCommandSetType == ECommandBufferAlf)
   292         {
   292         {
   293         TRAPD(err, iCanvasVisualData->iCanvasPainter->HandleBufferL(aDisplayRect, aAction, *this, aGc, DisplayRect().iTl.Round()));  
   293         TRAPD(err, iCanvasVisualData->iCanvasPainter->HandleBufferL(aDisplayRect, aAction, *this, aGc, DisplayRect().iTl.Round()));
   294         if (err)
   294         if (err)
   295         	{
   295         	{
   296         	HUI_DEBUG2(_L("CHuiCanvasVisual::HandleBufferL returned:%d command type was: %d"), err,iCanvasVisualData->iCommandSetType);
   296         	HUI_DEBUG2(_L("CHuiCanvasVisual::HandleBufferL returned:%d command type was: %d"), err,iCanvasVisualData->iCommandSetType);
   297         	}
   297         	}
   298         }
   298         }
   447         aGc.Clip(area);
   447         aGc.Clip(area);
   448         }
   448         }
   449 
   449 
   450     // Flag to know what we did
   450     // Flag to know what we did
   451     TBool didDrawEffect = EFalse;
   451     TBool didDrawEffect = EFalse;
       
   452     TBool drawChildren = ETrue; // only if didDrawEffect holds
   452     
   453     
   453     if (EffectActive())
   454     if (EffectActive())
   454         {
   455         {
   455         TBool refreshCache = EFalse;        
   456         TBool refreshCache = EFalse;        
   456         TBool layer =  EFalse;
   457         TBool layer =  EFalse;
   472         if(Display()->RosterImpl().AlfEventWindow() == this)
   473         if(Display()->RosterImpl().AlfEventWindow() == this)
   473             {
   474             {
   474             refreshCache |= Display()->RosterImpl().NativeAppsContentChanged();
   475             refreshCache |= Display()->RosterImpl().NativeAppsContentChanged();
   475             }
   476             }
   476         Effectable()->EffectSetOpacityAdditive(0.0f, ETrue);
   477         Effectable()->EffectSetOpacityAdditive(0.0f, ETrue);
       
   478         
   477         // PrepareDraw will update iEffectOpacity to correct opacity for this effect frame        
   479         // PrepareDraw will update iEffectOpacity to correct opacity for this effect frame        
   478         if(Effect()->PrepareDrawL(aGc, area))
   480         if(Effect()->PrepareDrawL(aGc, area))
   479             {
   481             {
   480 			// let's still check if effect is making visual fully transparent
   482 			// let's still check if effect is making visual fully transparent
   481             if(CanSkipDrawing())
   483             if(!CanSkipDrawing())
   482                 {
   484                 {
   483                 return;
   485                 // Note that EHuiVisualFlagOpaqueHint improves performance a lot in cached effect drawing 
       
   486                 TBool transparent = EFalse; 
       
   487                 
       
   488                 // This is special case, only child below group visual.
       
   489                 // Workaround - can be removed once opaque & transparent visual hierarchies are handled better.
       
   490                 if ( !Layout() && Count() == 1 ) 
       
   491                     {
       
   492                     const CHuiVisual* visual = &Visual(0);
       
   493 
       
   494                     transparent |= (!(visual->Flags() & EHuiVisualFlagOpaqueHint)); // Does not have opaque hint -> always transparent
       
   495                     transparent |= visual->iOpacity.Now() < 1.0f; // Opacity less than 1.0f -> always transparent
       
   496                     transparent |= visual->Effect() && !visual->LoadingEffect() && (visual->iEffectOpacity < 1.0f); // effect opacity is less than 1.0f
       
   497                     }
       
   498 
       
   499                 transparent |= (!(Flags() & EHuiVisualFlagOpaqueHint)); // Does not have opaque hint -> always transparent
       
   500                 transparent |= iOpacity.Now() < 1.0f; // Opacity less than 1.0f -> always transparent
       
   501                 transparent |= iEffectOpacity < 1.0f; // effect opacity is less than 1.0f
       
   502                 
       
   503                 didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion, layer );
   484                 }
   504                 }
   485             // Note that EHuiVisualFlagOpaqueHint improves performance a lot in cached effect drawing 
   505             else
   486             TBool transparent = EFalse; 
   506                 {
   487             transparent |= (!(Flags() & EHuiVisualFlagOpaqueHint)); // Does not have opaque hint -> always transparent
   507                 didDrawEffect = ETrue;
   488             transparent |= iOpacity.Now() < 1.0f; // Opacity less than 1.0f -> always transparent
   508                 drawChildren = EFalse;
   489             transparent |= iEffectOpacity < 1.0f; // effect opacity is less than 1.0f
   509                 }
   490 
       
   491             didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion, layer );
       
   492             }
   510             }
   493         }
   511         }
   494     
   512     
   495     if ( !didDrawEffect )
   513     if ( !didDrawEffect )
   496         {
   514         {
   505     if (!didDrawEffect)
   523     if (!didDrawEffect)
   506         {
   524         {
   507         // Draw all children
   525         // Draw all children
   508         DrawCanvasChildren(aGc, 0, 0);
   526         DrawCanvasChildren(aGc, 0, 0);
   509         }
   527         }
   510     else if (didDrawEffect && !EffectIsAppliedToChildren())
   528     else if (didDrawEffect && drawChildren && !EffectIsAppliedToChildren())
   511         {
   529         {
   512         // Draw all children
   530         // Draw all children
   513         DrawCanvasChildren(aGc, 0, 0);    
   531         DrawCanvasChildren(aGc, 0, 0);    
   514         }
   532         }
   515     else if (didDrawEffect && EffectIsAppliedToChildren())
   533     else if (didDrawEffect && drawChildren && EffectIsAppliedToChildren())
   516         {
   534         {
   517         // Draw only children which do not want to have parent effect applied to them
   535         // Draw only children which do not want to have parent effect applied to them
   518         DrawCanvasChildren(aGc, EHuiCanvasFlagExcludeFromParentEffect, 0);        
   536         DrawCanvasChildren(aGc, EHuiCanvasFlagExcludeFromParentEffect, 0);        
   519         }
   537         }
   520 
   538