[4.0] Changed Update to reset only target properties each frame
[platform/core/uifw/dali-core.git] / dali / internal / update / animation / scene-graph-constraint-base.cpp
index c79e39d..7c39de9 100644 (file)
@@ -1,25 +1,23 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // CLASS HEADER
 #include <dali/internal/update/animation/scene-graph-constraint.h>
 
-// INTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint.h>
-
 namespace Dali
 {
 
@@ -29,13 +27,22 @@ namespace Internal
 namespace SceneGraph
 {
 
-ConstraintBase::ConstraintBase( PropertyOwnerSet& ownerSet )
-: mWeight( Dali::ActiveConstraint::DEFAULT_WEIGHT ),
-  mRemoveAction( Dali::Constraint::DEFAULT_REMOVE_ACTION ),
+#ifdef DEBUG_ENABLED
+  unsigned int ConstraintBase::mCurrentInstanceCount = 0;
+  unsigned int ConstraintBase::mTotalInstanceCount   = 0;
+#endif
+
+ConstraintBase::ConstraintBase( PropertyOwnerContainer& ownerSet, RemoveAction removeAction )
+: mRemoveAction( removeAction ),
   mFirstApply( true ),
   mDisconnected( true ),
-  mObservedOwners( ownerSet )
+  mObservedOwners( ownerSet ),
+  mLifecycleObserver( nullptr )
 {
+#ifdef DEBUG_ENABLED
+  ++mCurrentInstanceCount;
+  ++mTotalInstanceCount;
+#endif
 }
 
 ConstraintBase::~ConstraintBase()
@@ -45,17 +52,32 @@ ConstraintBase::~ConstraintBase()
     StopObservation();
   }
 
-// TODO - Override new & delete to provide this for everything
+  if( mLifecycleObserver != nullptr )
+  {
+    mLifecycleObserver->ObjectDestroyed();
+  }
+
+#ifdef DEBUG_ENABLED
+  --mCurrentInstanceCount;
+#endif
+}
+
+unsigned int ConstraintBase::GetCurrentInstanceCount()
+{
 #ifdef DEBUG_ENABLED
-  // Fill with garbage pattern to help detect invalid memory access
-  memset ( &mWeight, 0xFA, sizeof(mWeight) );
+  return mCurrentInstanceCount;
+#else
+  return 0u;
 #endif
 }
 
-void ConstraintBase::ResetDefaultProperties( BufferIndex updateBufferIndex )
+unsigned int ConstraintBase::GetTotalInstanceCount()
 {
-  // Not used, since the weight property is reset by PropertyOwner
-  DALI_ASSERT_DEBUG( false );
+#ifdef DEBUG_ENABLED
+  return mTotalInstanceCount;
+#else
+  return 0u;
+#endif
 }
 
 } // namespace SceneGraph