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