uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp
branchRCL_3
changeset 18 1801340c26a2
parent 17 c9d868f1e20c
child 19 e5af45d51884
equal deleted inserted replaced
17:c9d868f1e20c 18:1801340c26a2
    83 #endif
    83 #endif
    84     }
    84     }
    85 
    85 
    86 EXPORT_C CHuiFxEffect::~CHuiFxEffect()
    86 EXPORT_C CHuiFxEffect::~CHuiFxEffect()
    87     {
    87     {
       
    88     ReleaseCachedRenderTarget();
       
    89     
    88     delete iRoot;
    90     delete iRoot;
    89     iRoot = NULL;
    91     iRoot = NULL;
    90     NotifyEffectEndObserver();
    92     NotifyEffectEndObserver();
    91     
       
    92     ReleaseCachedRenderTarget();
       
    93     
       
    94     iEngine->RemoveEffect(this);
    93     iEngine->RemoveEffect(this);
    95     if (iEngine && iGroupId != KErrNotFound && !(iFlags & KHuiReadyToDrawNotified))
    94     if (iEngine && iGroupId != KErrNotFound && !(iFlags & KHuiReadyToDrawNotified))
    96         {
    95         {
    97         // if effect was deleted before it was drawn, the group must be notified. If this was the last effect in the group
    96         // if effect was deleted before it was drawn, the group must be notified. If this was the last effect in the group
    98         // the group will be removed by the EffectReadyToStart
    97         // the group will be removed by the EffectReadyToStart
   179     if (iCachedRenderTarget)
   178     if (iCachedRenderTarget)
   180         {
   179         {
   181         iEngine->ReleaseRenderbuffer(iCachedRenderTarget);
   180         iEngine->ReleaseRenderbuffer(iCachedRenderTarget);
   182         iCachedRenderTarget = NULL;
   181         iCachedRenderTarget = NULL;
   183         }                
   182         }                
       
   183     
       
   184     if(iRoot)
       
   185         {
       
   186         iRoot->ReleaseAllCachedRenderTargets(*iEngine);
       
   187         }
   184     }
   188     }
   185 
   189 
   186 void CHuiFxEffect::PrepareCachedRenderTarget(const TPoint& aPosition, const TSize& aSize, TBool aClear, TBool aEnableBackground)
   190 void CHuiFxEffect::PrepareCachedRenderTarget(const TPoint& aPosition, const TSize& aSize, TBool aClear, TBool aEnableBackground)
   187     {
   191     {
   188     // If size has chnaged, we must delete old one
   192     // If size has chnaged, we must delete old one
   189     if (iCachedRenderTarget && 
   193     if (iCachedRenderTarget && 
   190         iCachedRenderTarget->Size() != aSize)
   194         iCachedRenderTarget->Size() != aSize)
   191         {
   195         {
   192         ReleaseCachedRenderTarget();
   196         iEngine->ReleaseRenderbuffer(iCachedRenderTarget);
       
   197         iCachedRenderTarget = NULL;
   193         }            
   198         }            
   194     
   199     
   195     // Accure new buffer
   200     // Accure new buffer
   196     if (!iCachedRenderTarget)
   201     if (!iCachedRenderTarget)
   197         {
   202         {
   439             }
   444             }
   440         }
   445         }
   441     else
   446     else
   442         {
   447         {
   443         // Release cached render target just in case it is reserved for some reason
   448         // Release cached render target just in case it is reserved for some reason
   444         ReleaseCachedRenderTarget();
   449         if (iCachedRenderTarget)
       
   450             {
       
   451             iEngine->ReleaseRenderbuffer(iCachedRenderTarget);
       
   452             iCachedRenderTarget = NULL;
       
   453             }  
   445 
   454 
   446         // Use default onscreen render target
   455         // Use default onscreen render target
   447         if (!target)
   456         if (!target)
   448             {
   457             {
   449             target = iEngine->DefaultRenderbuffer();
   458             target = iEngine->DefaultRenderbuffer();