uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp
branchRCL_3
changeset 63 e1987ab3768a
parent 57 eaa079afe64c
equal deleted inserted replaced
57:eaa079afe64c 63:e1987ab3768a
    58         {
    58         {
    59         iTacticons.Close();
    59         iTacticons.Close();
    60         delete iDropShadow;
    60         delete iDropShadow;
    61         delete iEffectParser;
    61         delete iEffectParser;
    62         delete iEffect;
    62         delete iEffect;
    63         delete iEffectable; // Should be after deleting iEffect! 
       
    64 
       
    65         }
    63         }
    66     
    64     
    67     // structs
    65     // structs
    68     struct TTacticon
    66     struct TTacticon
    69         {
    67         {
    83     };
    81     };
    84 class CHuiEffectable : public CBase, public MHuiEffectable
    82 class CHuiEffectable : public CBase, public MHuiEffectable
    85     {
    83     {
    86 public: // from MHuiEffectable
    84 public: // from MHuiEffectable
    87     CHuiEffectable(CHuiVisual *aVisual) : iVisual(aVisual) { }
    85     CHuiEffectable(CHuiVisual *aVisual) : iVisual(aVisual) { }
    88 
       
    89     void EffectSetEffect(CHuiFxEffect* aEffect);
    86     void EffectSetEffect(CHuiFxEffect* aEffect);
    90     TReal32 EffectOpacity() const;
    87     TReal32 EffectOpacity() const;
    91     void EffectSetOpacityAdditive(TReal32 aOpacity, TBool aReplace);
    88     void EffectSetOpacityAdditive(TReal32 aOpacity, TBool aReplace);
    92     void EffectDrawSelf( CHuiGc &aGc, const TRect & aDisplayRect) const;
    89     void EffectDrawSelf( CHuiGc &aGc, const TRect & aDisplayRect) const;
    93     THuiRealRect EffectDisplayRect() const __SOFTFP;
    90     THuiRealRect EffectDisplayRect() const __SOFTFP;
    94     void SetLoadingEffect(TBool aLoading);    
    91     void SetLoadingEffect(TBool aLoading);    
    95     void EffectSetSource( THuiFxVisualSrcType aSource );
    92     void EffectSetSource( TBool aIsInput1 );
    96     THuiFxVisualSrcType EffectGetSource() const;
    93     TBool EffectGetSource() const;
    97     void SetExternalTexture(CHuiTexture* aTexture);
       
    98     CHuiTexture* ExternalTexture();
       
    99     TBool EffectReadyToDrawNextFrame() const;
    94     TBool EffectReadyToDrawNextFrame() const;
       
    95 
   100     
    96     
   101 private:
    97 private:
   102     CHuiVisual *iVisual; // not owned
    98     CHuiVisual *iVisual;
   103     CHuiTexture* iExtTexture; // not owned
    99     TBool iIsInput1;
   104     THuiFxVisualSrcType iSourceType;
       
   105     };
   100     };
   106 void CHuiEffectable::EffectSetEffect(CHuiFxEffect* aEffect)
   101 void CHuiEffectable::EffectSetEffect(CHuiFxEffect* aEffect)
   107     {
   102     {
   108     iVisual->SetEffect(aEffect);
   103     iVisual->SetEffect(aEffect);
   109     }
   104     }
   110 void CHuiEffectable::EffectSetSource( THuiFxVisualSrcType aSource )
   105 void CHuiEffectable::EffectSetSource( TBool aIsInput1 )
   111     {
   106     {
   112     iSourceType = aSource;
   107     iIsInput1 = aIsInput1;
   113     }
   108     }
   114 THuiFxVisualSrcType CHuiEffectable::EffectGetSource() const
   109 TBool CHuiEffectable::EffectGetSource() const
   115     {
   110     {
   116     return iSourceType;
   111     return iIsInput1;
   117     }
       
   118 
       
   119 void CHuiEffectable::SetExternalTexture(CHuiTexture* aTexture)
       
   120     {
       
   121     iExtTexture = aTexture;
       
   122     }
       
   123 
       
   124 CHuiTexture* CHuiEffectable::ExternalTexture()
       
   125     {
       
   126     return iExtTexture;
       
   127     }
   112     }
   128 
   113 
   129 TBool CHuiEffectable::EffectReadyToDrawNextFrame() const
   114 TBool CHuiEffectable::EffectReadyToDrawNextFrame() const
   130     {
   115     {
   131     return iVisual->EffectReadyToDrawNextFrame();
   116     return iVisual->EffectReadyToDrawNextFrame();
   205 EXPORT_C void CHuiVisual::SetFreezeState(TBool aEnabled)
   190 EXPORT_C void CHuiVisual::SetFreezeState(TBool aEnabled)
   206     {
   191     {
   207     iVisualData->iFreezed = aEnabled;
   192     iVisualData->iFreezed = aEnabled;
   208     }
   193     }
   209 TBool CHuiVisual::Freezed() const
   194 TBool CHuiVisual::Freezed() const
   210     {
   195 {
   211     return iVisualData->iFreezed;
   196     return iVisualData->iFreezed;
   212     }
   197 }
   213 
   198 
   214 EXPORT_C TBool CHuiVisual::EffectReadyToDrawNextFrame() const
   199 EXPORT_C TBool CHuiVisual::EffectReadyToDrawNextFrame() const
   215     {
   200     {
   216     return  ETrue;
   201     return  ETrue;
   217     }
   202     }
   221     {
   206     {
   222     CHuiVisual* visual = STATIC_CAST(CHuiVisual*,
   207     CHuiVisual* visual = STATIC_CAST(CHuiVisual*,
   223         aOwnerControl.AppendVisualL(EHuiVisualTypeVisual, aParentLayout));
   208         aOwnerControl.AppendVisualL(EHuiVisualTypeVisual, aParentLayout));
   224     return visual;
   209     return visual;
   225     }
   210     }
       
   211 
   226 
   212 
   227 EXPORT_C CHuiVisual::CHuiVisual(MHuiVisualOwner& aOwner)
   213 EXPORT_C CHuiVisual::CHuiVisual(MHuiVisualOwner& aOwner)
   228         : iOpacity(1.f),
   214         : iOpacity(1.f),
   229           iEffectOpacity(1.f),
   215           iEffectOpacity(1.f),
   230           iOwner(&aOwner), 
   216           iOwner(&aOwner), 
   292     delete iBrushes;
   278     delete iBrushes;
   293     delete iTag;
   279     delete iTag;
   294     delete iTransform;
   280     delete iTransform;
   295     if (iVisualData)
   281     if (iVisualData)
   296         {
   282         {
       
   283         delete iVisualData->iEffectable;
   297         if (iVisualData->iStoredRenderBuffer)
   284         if (iVisualData->iStoredRenderBuffer)
   298             {
   285             {
   299             iVisualData->iStoredRenderBuffer->UnInitialize();
   286             iVisualData->iStoredRenderBuffer->UnInitialize();
   300             }
   287             }
   301         delete iVisualData->iStoredRenderBuffer;
   288         delete iVisualData->iStoredRenderBuffer;
  2205     {
  2192     {
  2206     if (!Effectable())
  2193     if (!Effectable())
  2207         return EFalse;
  2194         return EFalse;
  2208     else
  2195     else
  2209         {
  2196         {
  2210         THuiFxVisualSrcType sourceType = Effectable()->EffectGetSource(); 
  2197         TBool b = Effectable()->EffectGetSource();
  2211 
  2198         if (!b)
  2212         if (sourceType == EVisualSrcVisual)
  2199             { // if not found from this object, try the parent
  2213             { // if this object has visual source, check the parent
  2200             CHuiLayout *l = Layout();
  2214             CHuiLayout *layout = Layout();
  2201             if (l)
  2215             if (layout)
  2202                 return Layout()->IsDelayedEffectSource();
  2216                 {
  2203             }
  2217                 return (Layout()->IsDelayedEffectSource()); 
  2204         return b;
  2218                 }
       
  2219 	        else
       
  2220 	            {
       
  2221 	            return EFalse;
       
  2222 	            }
       
  2223             }
       
  2224         else
       
  2225             {
       
  2226             return ETrue;
       
  2227             }
       
  2228         }
  2205         }
  2229    }
  2206    }
  2230 
  2207 
  2231 EXPORT_C void CHuiVisual::SetEffect(CHuiFxEffect* aEffect)
  2208 EXPORT_C void CHuiVisual::SetEffect(CHuiFxEffect* aEffect)
  2232     {
  2209     {