stop using deprecated shader inheritance 35/25535/2
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Wed, 6 Aug 2014 15:14:28 +0000 (16:14 +0100)
committerPaul Wisbey <p.wisbey@samsung.com>
Thu, 14 Aug 2014 15:04:24 +0000 (16:04 +0100)
requires https://review.tizen.org/gerrit/#/c/25534/

Change-Id: Ieb5e7b2dbb7076aa1af837c53767cc554eb0f42b

15 files changed:
base/dali-toolkit/internal/builder/builder-impl.cpp
base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp
base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp
optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
optional/dali-toolkit/internal/controls/image-view/image-view-impl.cpp
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-landscape-view-impl.cpp
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-landscape-view-impl.h
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.h
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h
optional/dali-toolkit/public-api/shader-effects/motion-blur-effect.cpp
optional/dali-toolkit/public-api/shader-effects/motion-blur-effect.h
optional/dali-toolkit/public-api/shader-effects/motion-stretch-effect.cpp
optional/dali-toolkit/public-api/shader-effects/motion-stretch-effect.h

index 917eadf..544c428 100644 (file)
@@ -253,12 +253,15 @@ void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replace
       // special field 'effect' references the shader effect instances
       if(key == "effect")
       {
-        Actor actor = Actor::DownCast(handle);
-        OptionalString s = constant.IsString( keyChild.second );
-        if(actor && s)
+        RenderableActor actor = RenderableActor::DownCast(handle);
+        if( actor )
         {
-          ShaderEffect e = GetShaderEffect(*s, constant);
-          actor.SetShaderEffect(e);
+          OptionalString str = constant.IsString( keyChild.second );
+          if( str )
+          {
+            ShaderEffect effect = GetShaderEffect( *str, constant );
+            actor.SetShaderEffect(effect);
+          }
         }
         else
         {
@@ -274,7 +277,7 @@ void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replace
 
       if( Property::INVALID_INDEX == index )
       {
-        Actor actor = Actor::DownCast(propertyObject);
+        RenderableActor actor = RenderableActor::DownCast(handle);
         if( actor )
         {
           if( ShaderEffect effect = actor.GetShaderEffect() )
index ed639e2..901e96c 100644 (file)
@@ -691,7 +691,6 @@ void Decorator::CreateHighlight( Actor parent )
   {
     mHighlightMeshActor = MeshActor::New( mTextHighlight.CreateHighLightMesh() );
     mHighlightMeshActor.SetName( "HighlightMeshActor" );
-    mHighlightMeshActor.SetInheritShaderEffect( false );
     mHighlightMeshActor.SetAffectedByLighting(false);
     parent.Add( mHighlightMeshActor );
   }
index da3443f..7a0729c 100644 (file)
@@ -4741,7 +4741,6 @@ void TextInput::CreateHighlight()
 
     mHighlightMeshActor = MeshActor::New( mHighlightMesh );
     mHighlightMeshActor.SetName( "HighlightMeshActor" );
-    mHighlightMeshActor.SetInheritShaderEffect( false );
     mHighlightMeshActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
     mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
     mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
index 92dca9f..cad5080 100644 (file)
@@ -203,10 +203,16 @@ void BubbleEmitter::SetBubbleDensity( unsigned int density )
 // clear the resources created for the off screen rendering
 void BubbleEmitter::OnRenderFinished(RenderTask& source)
 {
-  Actor sourceActor =  source.GetSourceActor();
-  sourceActor.RemoveShaderEffect();
+  Actor sourceActor = source.GetSourceActor();
+  if( sourceActor )
+  {
+    RenderableActor renderable = RenderableActor::DownCast( sourceActor );
+    if( renderable )
+    {
+      renderable.RemoveShaderEffect();
+    }
+  }
   Stage::GetCurrent().Remove(sourceActor);
-  sourceActor.Reset();
   Stage::GetCurrent().GetRenderTaskList().RemoveTask(source);
 }
 
index a7becfc..2601644 100644 (file)
@@ -176,7 +176,7 @@ void ImageView::SetImageDistanceField(const std::string& filename)
   mImageActor.SetImage( image );
 
   DistanceFieldEffect effect = DistanceFieldEffect::New();
-  Self().SetShaderEffect( effect );
+  mImageActor.SetShaderEffect( effect );
 }
 
 void ImageView::SetImage(Image image)
index ed81ebf..d4beab2 100644 (file)
@@ -123,7 +123,7 @@ void PageTurnLandscapeView::SetPanActor( const Vector2& panPosition )
   }
 }
 
-void PageTurnLandscapeView::SetSpineEffect(Actor actor, bool isLeftSide)
+void PageTurnLandscapeView::SetSpineEffect(ImageActor actor, bool isLeftSide)
 {
   if(isLeftSide)
   {
index f908141..0e9c635 100644 (file)
@@ -83,7 +83,7 @@ protected: // From PageTurnView
   /**
    * @copydoc PageTurnView::SetSpineEffect
    */
-  virtual void SetSpineEffect(Actor actor, bool isLeftSide);
+  virtual void SetSpineEffect(ImageActor actor, bool isLeftSide);
 
 private:
 
index 95a6708..5f169bb 100644 (file)
@@ -93,7 +93,7 @@ void PageTurnPortraitView::SetPanActor( const Vector2& panPosition )
   }
 }
 
-void PageTurnPortraitView::SetSpineEffect(Actor actor, bool isLeftSide)
+void PageTurnPortraitView::SetSpineEffect(ImageActor actor, bool isLeftSide)
 {
   if(isLeftSide)
   {
@@ -111,7 +111,7 @@ void PageTurnPortraitView::OnPossibleOutwardsFlick( const Vector2& panPosition,
   // There is previous page and an outwards flick is detected
   if( mCurrentPageIndex > 0 && gestureSpeed > GESTURE_SPEED_THRESHOLD && offset.x > fabs( offset.y ))
   {
-    Actor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ];
+    ImageActor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ];
     if(actor.GetParent() != mRootOnScreen)
     {
       return;
index 16abf9b..cc2e5ec 100644 (file)
@@ -82,7 +82,7 @@ protected: // From PageTurnView
   /**
    * @copydoc PageTurnView::SetSpineEffect
    */
-  virtual void SetSpineEffect(Actor actor, bool isLeftSide);
+  virtual void SetSpineEffect(ImageActor actor, bool isLeftSide);
 
   /**
    * @copydoc PageTurnView::OnPossibleOutwardsFlick
index 83006d4..edac01e 100644 (file)
@@ -917,7 +917,7 @@ void PageTurnView::PanFinished( const Vector2& gesturePosition, float gestureSpe
 
   mPagePanFinishedSignal.Emit( handle );
 
-  Actor actor = mPanActor;
+  ImageActor actor = mPanActor;
   if(mPress)
   {
     if(!mConstraints) // if with constraints, the pan finished position is near spine, set up an animation to turn the page over
@@ -977,7 +977,7 @@ void PageTurnView::PanFinished( const Vector2& gesturePosition, float gestureSpe
 
 void PageTurnView::TurnedOver( Animation& animation )
 {
-  Actor actor = mAnimationActorPair[animation];
+  ImageActor actor = mAnimationActorPair[animation];
   mIsTurnBack[actor] = !mIsTurnBack[actor];
   actor.RemoveConstraints();
   mRootOnScreen.Add(actor);
@@ -996,7 +996,7 @@ void PageTurnView::TurnedOver( Animation& animation )
 
 void PageTurnView::SliddenBack( Animation& animation )
 {
-  Actor actor = mAnimationActorPair[animation];
+  ImageActor actor = mAnimationActorPair[animation];
   mRootOnScreen.Add(actor);
   int index = mAnimationIndexPair[animation];
   mIsSliding[index] = false;
@@ -1026,14 +1026,9 @@ void PageTurnView::OrganizePageDepth()
   }
 }
 
-void PageTurnView::SetShaderEffect( Actor actor, ShaderEffect shaderEffect )
+void PageTurnView::SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect )
 {
-  actor.SetShaderEffect( shaderEffect );
-
-  if( actor.GetChildCount() > 0 )
-  {
-    actor.GetChildAt( 0 ).SetShaderEffect(shaderEffect);
-  }
+  SetShaderEffectRecursively( actor, shaderEffect );
 }
 
 Toolkit::PageTurnView::PageTurnSignal& PageTurnView::PageTurnStartedSignal()
index f549dca..2e3f856 100644 (file)
@@ -134,7 +134,7 @@ protected:
    * @param[in] actor The actor which the shader effect would be applied onto
    * @param[in] shaderEffect The shader effect to be set to the actor
    */
-  void SetShaderEffect( Actor actor, ShaderEffect shaderEffect );
+  void SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect );
 
 private:
 
@@ -253,7 +253,7 @@ private: // implemented differently by PageTurnLandscapeView and PageTurnPortrai
    * @param[in] actor The current page actor
    * @param[in] isLeftSide Which side the current page is located
    */
-  virtual void SetSpineEffect(Actor actor, bool isLeftSide) = 0;
+  virtual void SetSpineEffect(ImageActor actor, bool isLeftSide) = 0;
 
   /**
    * This method is called when pan finished to detect outwards flick
@@ -327,8 +327,8 @@ protected:
 
   std::vector<ImageActor>        mPageActors;              ///< The vector of pages on stage
   int                            mCurrentPageIndex;        ///< The index of the current page, between 0 ~ mTotalPageCount-1
-  std::map<Actor,bool>           mIsTurnBack;              ///< The map to keep track the page actor's turning direction
-  std::map<Animation, Actor>     mAnimationActorPair;      ///< The map to keep track which page actor is the animation act on
+  std::map<ImageActor,bool>      mIsTurnBack;              ///< The map to keep track the page actor's turning direction
+  std::map<Animation,ImageActor> mAnimationActorPair;      ///< The map to keep track which page actor is the animation act on
   std::map<Animation, int>       mAnimationIndexPair;      ///< The map to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is used for the animation
   int                            mIndex;                   ///< The index to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is used for the current panning page
   std::vector<bool>              mIsAnimating;             ///< The boolean vector to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is available for using
index 830accc..b6268bd 100644 (file)
@@ -74,15 +74,15 @@ MotionBlurEffect::~MotionBlurEffect()
 {
 }
 
-MotionBlurEffect MotionBlurEffect::Apply( Actor handle )
+MotionBlurEffect MotionBlurEffect::Apply( RenderableActor renderable )
 {
   MotionBlurEffect newEffect = New( MOTION_BLUR_NUM_SAMPLES );
-  handle.SetShaderEffect( newEffect );
+  renderable.SetShaderEffect( newEffect );
 
   Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_BLUR_MODEL_LASTFRAME );
 
   Constraint constraint = Constraint::New<Matrix>( uModelProperty,
-                                                   Source( handle, Actor::WORLD_MATRIX ),
+                                                   Source( renderable, Actor::WORLD_MATRIX ),
                                                    EqualToConstraint() );
 
   // and set up constraint.
@@ -95,7 +95,7 @@ MotionBlurEffect MotionBlurEffect::New()
   return New( MOTION_BLUR_NUM_SAMPLES );
 }
 
-MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples )
+MotionBlurEffect MotionBlurEffect::New( unsigned int numBlurSamples )
 {
   // Dali vertexSource prefix for reference:
   // precision highp float;
index 053531b..d9a5b09 100644 (file)
@@ -75,18 +75,20 @@ public:
    * Create a  MotionBlurEffect and attach it to the specified actor
    * The number of texture samples taken along the motion velocity vector of the
    * actor, producing the blur, is set to a default of 8.
+   * @param renderable actor to apply the effect to
    * @return A handle to a newly allocated Dali resource.
    */
-  static MotionBlurEffect Apply( Actor handle );
+  static MotionBlurEffect Apply( RenderableActor renderable );
 
   /**
    * Create an initialized MotionBlurEffect
    * @param numBlurSamples The number of texture samples taken along the motion
    * velocity vector of the actor, producing the blur. A higher number gives a
    * smoother blur but costs more in terms of performance.
+   * @param numBlurSamples to have
    * @return A handle to a newly allocated Dali resource.
    */
-  static MotionBlurEffect New( const unsigned int numBlurSamples );
+  static MotionBlurEffect New( unsigned int numBlurSamples );
 
   /**
    * Set texcoord scale property. This scales the offset for texture samples
index 3834f40..ffc068b 100644 (file)
@@ -88,15 +88,15 @@ MotionStretchEffect::~MotionStretchEffect()
 {
 }
 
-MotionStretchEffect MotionStretchEffect::Apply( Actor handle )
+MotionStretchEffect MotionStretchEffect::Apply( RenderableActor renderable )
 {
   MotionStretchEffect newEffect = New();
-  handle.SetShaderEffect( newEffect );
+  renderable.SetShaderEffect( newEffect );
 
   Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_STRETCH_MODELVIEW_LASTFRAME );
 
   Constraint constraint = Constraint::New<Matrix>( uModelProperty,
-                                                   Source( handle, Actor::WORLD_MATRIX ),
+                                                   Source( renderable, Actor::WORLD_MATRIX ),
                                                    EqualToConstraint() );
 
   // and set up constraint.
index e097748..ceef5ad 100644 (file)
@@ -70,9 +70,10 @@ public:
 
   /**
    * Create a  MotionStretchEffect and attach it to the specified actor
+   * @param renderable actor to apply the effect to
    * @return A handle to a newly allocated Dali resource.
    */
-  static MotionStretchEffect Apply( Actor handle );
+  static MotionStretchEffect Apply( RenderableActor renderable );
 
   /**
    * Set geometry stretch factor property. This scales the amount the geometry