Deprecated Layer::TREE_DEPTH_MULTIPLIER and fixed mis-usage. 64/113464/2
authorDavid Steele <david.steele@samsung.com>
Tue, 7 Feb 2017 18:15:42 +0000 (18:15 +0000)
committerDavid Steele <david.steele@samsung.com>
Wed, 8 Feb 2017 13:09:39 +0000 (13:09 +0000)
Layer::TREE_DEPTH_MULITPLIER has the wrong value for our sorting
algorithm, and has been replaced by DevelLayer::TREE_DEPTH_MULTIPLIER,
which is now set to 1,000,000. Updated HitTestAlgorithm to also use the
correct value.

Change-Id: I7015f485f62a273f9c082171d81cca217dafb7d0
Signed-off-by: David Steele <david.steele@samsung.com>
dali/devel-api/actors/layer-devel.h
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/actors/actor-impl.h
dali/internal/event/events/hit-test-algorithm-impl.cpp
dali/public-api/actors/layer.h

index 47e7a02..a8637b7 100644 (file)
@@ -28,12 +28,12 @@ namespace DevelLayer
 {
 
   /**
-   * @brief TREE_DEPTH_MULTIPLIER is used by the rendering sorting algorithm to decide which actors to render first.
+   * @brief ACTOR_DEPTH_MULTIPLIER is used by the rendering sorting algorithm to decide which actors to render first.
    * @SINCE_1_0.0
    */
-  enum TreeDepthMultiplier
+  enum ActorDepthMultiplier
   {
-    TREE_DEPTH_MULTIPLIER = 1000000,
+    ACTOR_DEPTH_MULTIPLIER = 1000000,
   };
 
   /**
index 1fdb485..1f0fe49 100644 (file)
@@ -359,7 +359,7 @@ float GetDimensionValue( const Vector3& values, Dimension::Type dimension )
 
 unsigned int GetDepthIndex( uint16_t depth, uint16_t siblingOrder )
 {
-  return depth * Dali::DevelLayer::TREE_DEPTH_MULTIPLIER + siblingOrder * Dali::DevelLayer::SIBLING_ORDER_MULTIPLIER;
+  return depth * Dali::DevelLayer::ACTOR_DEPTH_MULTIPLIER + siblingOrder * Dali::DevelLayer::SIBLING_ORDER_MULTIPLIER;
 }
 
 } // unnamed namespace
@@ -1017,6 +1017,11 @@ ClippingMode::Type Actor::GetClippingMode() const
   return mClippingMode;
 }
 
+unsigned int Actor::GetSortingDepth()
+{
+  return GetDepthIndex( mDepth, mSiblingOrder );
+}
+
 const Vector4& Actor::GetCurrentWorldColor() const
 {
   if( NULL != mNode )
index 1d37366..e917f7f 100644 (file)
@@ -743,7 +743,7 @@ public:
   /**
    * @copydoc Dali::Actor::GetHierarchyDepth()
    */
-  int GetHierarchyDepth() const
+  inline int GetHierarchyDepth() const
   {
     if( mIsOnStage )
     {
@@ -753,6 +753,14 @@ public:
     return -1;
   }
 
+  /**
+   * Get the actor's sorting depth (The hierarchy depth combined with
+   * the sibling order)
+   *
+   * @return The depth used for hit-testing and renderer sorting
+   */
+  unsigned int GetSortingDepth();
+
 public:
 
   // Size negotiation virtual functions
index 16118a9..d90e213 100644 (file)
@@ -249,7 +249,7 @@ HitActor HitTestWithinLayer( Actor& actor,
               hit.actor = &actor;
               hit.hitPosition = hitPointLocal;
               hit.distance = distance;
-              hit.depth = actor.GetHierarchyDepth() * Dali::Layer::TREE_DEPTH_MULTIPLIER;
+              hit.depth = actor.GetSortingDepth() ;
 
               if( actor.GetRendererCount() > 0 )
               {
index 1480db4..2e79342 100644 (file)
@@ -167,6 +167,8 @@ public:
   };
 
   /**
+   * @DEPRECATED_1_2.26. Not intended for application use.
+   *
    * @brief TREE_DEPTH_MULTIPLIER is used by the rendering sorting algorithm to decide which actors to render first.
    * @SINCE_1_0.0
    */
@@ -174,6 +176,7 @@ public:
   {
     TREE_DEPTH_MULTIPLIER = 10000,
   };
+
   /**
    * @brief The sort function type
    *