Changed shadow view to turn position inheritance off for blur filter
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / shadow-view / shadow-view-impl.cpp
index c1d614f..28bae71 100644 (file)
@@ -36,7 +36,6 @@
 // pixel format / size - set from JSON
 // aspect ratio property needs to be able to be constrained also for cameras. (now do-able)
 // default near clip value
-// mChildrenRoot Add()/Remove() overloads - better solution
 
 
 /////////////////////////////////////////////////////////
@@ -148,19 +147,6 @@ Toolkit::ShadowView ShadowView::New(float downsampleWidthScale, float downsample
   return handle;
 }
 
-/////////////////////////////////////////////////////////////
-// for creating a subtree for all user added child actors.
-// TODO: overloading Actor::Add()/Remove() not nice since breaks polymorphism. Need another method to pass ownership of added child actors to our internal actor root.
-void ShadowView::Add(Actor child)
-{
-  mChildrenRoot.Add(child);
-}
-
-void ShadowView::Remove(Actor child)
-{
-  mChildrenRoot.Remove(child);
-}
-
 void ShadowView::SetShadowPlaneBackground(Actor shadowPlaneBackground)
 {
   mShadowPlaneBg = shadowPlaneBackground;
@@ -241,7 +227,7 @@ void ShadowView::Deactivate()
 void ShadowView::OnInitialize()
 {
   // root actor to parent all user added actors. Used as source actor for shadow render task.
-  mChildrenRoot.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
+  mChildrenRoot.SetParentOrigin( ParentOrigin::CENTER );
   mChildrenRoot.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   Vector2 stageSize = Stage::GetCurrent().GetSize();
@@ -288,7 +274,8 @@ void ShadowView::OnInitialize()
   mBlurRootActor.SetName( "BLUR_ROOT_ACTOR" );
 
   // Turn off inheritance to ensure filter renders properly
-  mBlurRootActor.SetPositionInheritanceMode(USE_PARENT_POSITION);
+  mBlurRootActor.SetParentOrigin( ParentOrigin::CENTER );
+  mBlurRootActor.SetInheritPosition(false);
   mBlurRootActor.SetInheritOrientation(false);
   mBlurRootActor.SetInheritScale(false);
   mBlurRootActor.SetColorMode(USE_OWN_COLOR);
@@ -307,8 +294,21 @@ void ShadowView::OnInitialize()
   blurStrengthConstraint.Apply();
 }
 
-void ShadowView::OnSizeSet(const Vector3& targetSize)
+void ShadowView::OnChildAdd( Actor& child )
 {
+  Control::OnChildAdd( child );
+
+  if( child != mChildrenRoot && child != mBlurRootActor)
+  {
+    mChildrenRoot.Add( child );
+  }
+}
+
+void ShadowView::OnChildRemove( Actor& child )
+{
+  mChildrenRoot.Remove( child );
+
+  Control::OnChildRemove( child );
 }
 
 void ShadowView::ConstrainCamera()