If a RenderTask's exclusive actor is destoryed, then ensure the RenderTaskList of... 72/211172/4
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 30 Jul 2019 15:43:25 +0000 (16:43 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 31 Jul 2019 17:39:07 +0000 (18:39 +0100)
Change-Id: I59d797854242e2f2f204087b52c90c53946dfa9a

automated-tests/src/dali-internal/CMakeLists.txt
automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp [new file with mode: 0644]
automated-tests/src/dali/utc-Dali-RenderTask.cpp
automated-tests/src/dali/utc-Dali-RenderTaskList.cpp
automated-tests/src/dali/utc-Dali-TouchProcessing.cpp
dali/internal/event/events/actor-observer.cpp
dali/internal/event/events/actor-observer.h
dali/internal/event/events/hit-test-algorithm-impl.cpp
dali/internal/event/events/hit-test-algorithm-impl.h
dali/internal/event/render-tasks/render-task-list-impl.cpp
dali/internal/event/render-tasks/render-task-list-impl.h

index 92da36c..5c6a868 100644 (file)
@@ -6,6 +6,7 @@ SET(RPM_NAME "core-${PKG_NAME}-tests")
 SET(CAPI_LIB "dali-internal")
 
 SET(TC_SOURCES
+        utc-Dali-Internal-ActorObserver.cpp
         utc-Dali-Internal-Core.cpp
         utc-Dali-Internal-FixedSizeMemoryPool.cpp
         utc-Dali-Internal-FrustumCulling.cpp
diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-ActorObserver.cpp
new file mode 100644 (file)
index 0000000..f95ba2e
--- /dev/null
@@ -0,0 +1,298 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ */
+
+#include <iostream>
+
+#include <stdlib.h>
+
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/signals/callback.h>
+
+// Internal headers are allowed here
+#include <dali/internal/event/actors/actor-impl.h>
+#include <dali/internal/event/events/actor-observer.h>
+
+using namespace Dali;
+using ActorObserver = Internal::ActorObserver;
+
+namespace TestCallback
+{
+Internal::Actor* disconnectedActor = nullptr;
+int callCount = 0;
+void Function( Internal::Actor* actor )
+{
+  disconnectedActor = actor;
+  ++callCount;
+}
+
+void Reset()
+{
+  callCount = 0;
+  disconnectedActor = nullptr;
+}
+
+} // namespace TestCallback
+
+void utc_dali_internal_actor_observer_startup()
+{
+  test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_actor_observer_cleanup()
+{
+  test_return_value = TET_PASS;
+}
+
+int UtcDaliActorObserverTests(void)
+{
+  TestApplication application;
+
+  auto stage = Stage::GetCurrent();
+  auto actor = Actor::New();
+  auto& actorImpl = GetImplementation( actor );
+
+  // Ensure we're not observing anything at the start
+  ActorObserver actorObserver;
+  DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION );
+
+  // Set the actor and ensure GetActor returns the correct pointer
+  actorObserver.SetActor( &actorImpl );
+  DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION );
+
+  stage.Add( actor );
+  DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION );
+
+  // Removing the actor from the stage should make it return null
+  stage.Remove( actor );
+  DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION );
+
+  // Adding the actor back to the scene should mean it returning the actor again
+  stage.Add( actor );
+  DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION );
+
+  // Resetting the actor should return nullptr
+  actorObserver.ResetActor();
+  DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION );
+
+  // Set the actor again
+  actorObserver.SetActor( &actorImpl );
+  DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION );
+
+  // Create another Actor and observe that (don't add it to the stage just yet)
+  {
+    auto actor2 = Actor::New();
+    auto& actor2Impl = GetImplementation( actor2 );
+    actorObserver.SetActor( &actor2Impl );
+    DALI_TEST_EQUALS( actorObserver.GetActor(), &actor2Impl, TEST_LOCATION );
+  }
+
+  // Actor destroyed now, should return nullptr
+  DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliActorObserverGracefulDeletion(void)
+{
+  TestApplication application;
+
+  // Create an ActorObserver and observe an actor that outlives the observer...
+  // when the actor is destroyed, there should be no segmentation fault,
+  // i.e. the ActorObserver should unregister itself
+  try
+  {
+    {
+      // Scope lifetime of Actor
+      auto actor = Actor::New();
+      auto& actorImpl = GetImplementation( actor );
+
+      // Now scope the lifetime of ActorObserver
+      {
+        ActorObserver actorObserver;
+        actorObserver.SetActor( &actorImpl );
+      } // ActorObserver goes out of scope
+    } // Actor goes out of scope
+
+    // If we get here without a crash, then it's all good
+    DALI_TEST_CHECK( true );
+  }
+  catch( ... )
+  {
+    tet_infoline( "ActorObserver did not clean up properly" );
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliActorObserverMoveConstructorAndAssignmentEmpty(void)
+{
+  TestApplication application;
+
+  // Copy empty observer
+  ActorObserver observer1;
+  ActorObserver observer2( std::move( observer1 ) );
+  DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION );
+  DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION );
+
+  // Assign empty observer
+  observer1 = std::move( observer2 );
+  DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION );
+  DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION );
+
+  // Ensure self assignment doesn't change anything
+  observer1 = std::move( observer1 );
+  observer2 = std::move( observer2 );
+  DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION );
+  DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliActorObserverMoveConstructorAndAssignment(void)
+{
+  TestApplication application;
+
+  // Ensure new observer is observing the correct actor
+  // Ensure previous observer is not observing anything any more
+  auto actor = Actor::New();
+  auto& actorImpl = GetImplementation( actor );
+
+  ActorObserver observer1;
+  observer1.SetActor( &actorImpl );
+  DALI_TEST_EQUALS( observer1.GetActor(), &actorImpl, TEST_LOCATION );
+
+  // Move constructor
+  ActorObserver observer2( std::move( observer1 ) );
+  DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION );
+  DALI_TEST_EQUALS( observer2.GetActor(), &actorImpl, TEST_LOCATION );
+
+  // Move assignment
+  observer1 = std::move( observer2 );
+  DALI_TEST_EQUALS( observer1.GetActor(), &actorImpl, TEST_LOCATION );
+  DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION );
+
+  // Self assignment
+  observer1 = std::move( observer1 );
+  observer2 = std::move( observer2 );
+  DALI_TEST_EQUALS( observer1.GetActor(), &actorImpl, TEST_LOCATION );
+  DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliActorObserverEnsureRValueCleansUp(void)
+{
+  TestApplication application;
+
+  // ActorObservers observe the actors
+  // When an actor observer is moved, we need to ensure that the r-value observer cleans up after itself
+
+  // Here we're testing that we're handling this correctly by scoping the lifetime of the observer and actor
+  try
+  {
+    {
+      // Scope lifetime of Actor
+      auto actor = Actor::New();
+      auto& actorImpl = GetImplementation( actor );
+
+      // Score lifetime of observers
+      {
+        ActorObserver observer1;
+        observer1.SetActor( &actorImpl );
+        ActorObserver observer2( std::move( observer1 ) );
+      } // Both observers die here
+    } // Actor goes out of scope
+
+    // If we get here without a crash, then it's all good
+    DALI_TEST_CHECK( true );
+  }
+  catch( ... )
+  {
+    tet_infoline( "ActorObserver did not clean up properly" );
+    DALI_TEST_CHECK( false );
+  }
+
+  END_TEST;
+}
+
+int UtcDaliActorObserverFunctionCallback(void)
+{
+  TestApplication application;
+
+  // Test to ensure the passed in callback is called when the observed actor is disconnected
+  TestCallback::Reset();
+
+  auto stage = Stage::GetCurrent();
+  auto actor = Actor::New();
+  auto& actorImpl = GetImplementation( actor );
+  stage.Add( actor );
+
+  ActorObserver actorObserver( MakeCallback( &TestCallback::Function ) );
+  actorObserver.SetActor( &actorImpl );
+  DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION );
+  DALI_TEST_EQUALS( TestCallback::disconnectedActor, nullptr, TEST_LOCATION );
+
+  // Unstage Actor
+  actor.Unparent();
+  DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION );
+  DALI_TEST_EQUALS( TestCallback::disconnectedActor, &actorImpl, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliActorObserverFunctionCallbackEnsureNoDoubleDelete(void)
+{
+  TestApplication application;
+
+  // When we move an observer, we need to make sure we pass the ownership of a connected callback
+  // to ensure no double deletion.
+  TestCallback::Reset();
+
+  try
+  {
+    auto stage = Stage::GetCurrent();
+    auto actor = Actor::New();
+    auto& actorImpl = GetImplementation( actor );
+    stage.Add( actor );
+
+    ActorObserver *observer1 = new ActorObserver( MakeCallback( &TestCallback::Function ) );
+    observer1->SetActor( &actorImpl );
+
+    // Move observer1 into a new observer
+    ActorObserver* observer2 = new ActorObserver( std::move( *observer1 ) );
+
+    // Unstage Actor, function should be called only once
+    actor.Unparent();
+    DALI_TEST_EQUALS( TestCallback::disconnectedActor, &actorImpl, TEST_LOCATION );
+    DALI_TEST_EQUALS( TestCallback::callCount, 1, TEST_LOCATION );
+
+    // Delete both observers here, only one of them should delete the callback
+    delete observer1;
+    delete observer2;
+
+    // If we get here without a crash, then the callback has NOT been double-freed
+    DALI_TEST_CHECK( true );
+  }
+  catch( ... )
+  {
+    DALI_TEST_CHECK( false );
+    tet_infoline( "Callback double Freed" );
+  }
+
+  END_TEST;
+}
index 82d57a9..8067f58 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -757,6 +757,12 @@ int UtcDaliRenderTaskSetExclusive(void)
     // Test that task 2 renders actor2
     DALI_TEST_CHECK( boundTextures[2] == 9u );
   }
+
+  // Create a renderable actor and replace the source actor in task2
+  auto actor4 = CreateRenderableActor();
+  task2.SetSourceActor( actor3 );
+  DALI_TEST_EQUALS( actor3, task2.GetSourceActor(), TEST_LOCATION );
+
   END_TEST;
 }
 
index 2d69397..8b097c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -124,6 +124,29 @@ int UtcDaliRenderTaskListRemoveTask(void)
   END_TEST;
 }
 
+int UtcDaliRenderTaskListRemoveTaskWithExclusiveActor(void)
+{
+  TestApplication application;
+
+  tet_infoline("Testing RenderTaskList::RemoveTask() which has an exclusive actor set");
+
+  RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+  DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+
+  RenderTask newTask = taskList.CreateTask();
+  DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
+
+  auto actor = CreateRenderableActor();
+  newTask.SetSourceActor( actor );
+  newTask.SetExclusive( true );
+  DALI_TEST_EQUALS( actor, newTask.GetSourceActor(), TEST_LOCATION );
+  DALI_TEST_EQUALS( true, newTask.IsExclusive(), TEST_LOCATION );
+  taskList.RemoveTask( newTask );
+
+  DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+  END_TEST;
+}
+
 int UtcDaliRenderTaskListGetTaskCount(void)
 {
   TestApplication application;
index b5f0ec9..2f6d2ba 100755 (executable)
@@ -1004,6 +1004,37 @@ int UtcDaliTouchOffscreenRenderTasks(void)
   END_TEST;
 }
 
+int UtcDaliTouchRenderTaskWithExclusiveActor(void)
+{
+  TestApplication application;
+  auto stage = Stage::GetCurrent();
+  auto stageSize( stage.GetSize() );
+
+  auto actor = CreateRenderableActor();
+  actor.SetSize( stageSize.x, stageSize.y );
+  stage.Add( actor );
+
+  auto renderTask = stage.GetRenderTaskList().CreateTask();
+  renderTask.SetSourceActor( actor );
+  renderTask.SetExclusive( true );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Connect to actor's touched signal
+  SignalData data;
+  TouchEventFunctor functor( data );
+  actor.TouchedSignal().Connect( &application, functor );
+
+  // Emit a down signal
+  application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
+  DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+  data.Reset();
+
+  END_TEST;
+}
+
 int UtcDaliTouchMultipleRenderableActors(void)
 {
   TestApplication application;
@@ -1598,4 +1629,4 @@ int UtcDaliTouchDataConvert(void)
 
   END_TEST;
 
-}
\ No newline at end of file
+}
index 142783d..809251a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -34,31 +34,48 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACT
 }
 
 ActorObserver::ActorObserver()
-: mActor ( NULL ),
-  mActorDisconnected( false ),
-  mRemoveCallback( NULL )
+: ActorObserver( nullptr )
 {
-  DALI_LOG_TRACE_METHOD( gLogFilter );
 }
 
 ActorObserver::ActorObserver( CallbackBase* callback )
-: mActor ( NULL ),
+: mActor ( nullptr ),
   mActorDisconnected( false ),
   mRemoveCallback( callback )
 {
+  DALI_LOG_TRACE_METHOD( gLogFilter );
 }
 
 ActorObserver::~ActorObserver()
 {
   DALI_LOG_TRACE_METHOD( gLogFilter );
-  SetActor( NULL );
+  SetActor( nullptr );
 
   delete mRemoveCallback;
 }
 
-Actor* ActorObserver::GetActor()
+ActorObserver::ActorObserver( ActorObserver&& other )
+: ActorObserver( nullptr )
+{
+  operator=( std::move( other ) );
+}
+
+ActorObserver& ActorObserver::operator=( ActorObserver&& other )
+{
+  if( this != &other )
+  {
+    SetActor( other.mActor );
+    mActorDisconnected = other.mActorDisconnected;
+    mRemoveCallback = other.mRemoveCallback;
+    other.ResetActor();
+    other.mRemoveCallback = nullptr;
+  }
+  return *this;
+}
+
+Actor* ActorObserver::GetActor() const
 {
-  return mActorDisconnected ? NULL : mActor;
+  return mActorDisconnected ? nullptr : mActor;
 }
 
 void ActorObserver::SetActor( Actor* actor )
@@ -88,7 +105,17 @@ void ActorObserver::ResetActor()
   {
     DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Stop Observing:             %p\n", mActor);
     mActor->RemoveObserver( *this );
-    mActor = NULL;
+    mActor = nullptr;
+    mActorDisconnected = false;
+  }
+}
+
+void ActorObserver::SceneObjectAdded( Object& object )
+{
+  DALI_LOG_TRACE_METHOD( gLogFilter );
+
+  if ( mActor == &object )
+  {
     mActorDisconnected = false;
   }
 }
@@ -116,7 +143,7 @@ void ActorObserver::ObjectDestroyed(Object& object)
   if ( mActor == &object )
   {
     DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Stop Observing:             %p\n", mActor);
-    mActor = NULL;
+    mActor = nullptr;
   }
 }
 
index 9742b1f..31adc34 100644 (file)
@@ -64,13 +64,41 @@ public:
    */
   ~ActorObserver();
 
+  // Movable
+
+  /**
+   * Move constructor.
+   *
+   * @param[in] other The object to move the data from
+   *
+   * @note The other's actor is appropriately disconnected.
+   * @note Ownership of callback is passed onto this class.
+   */
+  ActorObserver( ActorObserver&& other );
+
+  /**
+   * Move assignment operator.
+   *
+   * @param[in] other The object to move the data from
+   *
+   * @note The other's actor is appropriately disconnected.
+   * @note Ownership of callback is passed onto this class.
+   */
+  ActorObserver& operator=( ActorObserver&& other );
+
+  // Not copyable
+
+  ActorObserver( const ActorObserver& ) = delete;   ///< Deleted copy constructor.
+  ActorObserver& operator=( const ActorObserver& ) = delete;   ///< Deleted copy assignment operator.
+
   // Methods
 
   /**
    * Return the stored Actor pointer.
    * @return The Actor pointer.
+   * @note Returns nullptr while the observed actor is not on the scene.
    */
-  Actor* GetActor();
+  Actor* GetActor() const;
 
   /**
    * Assignment operator.
@@ -86,33 +114,26 @@ public:
 
 private:
 
-  // Undefined
-  ActorObserver( const ActorObserver& );
-  ActorObserver& operator=( const ActorObserver& );
-
-private:
-
   /**
-   * This will never get called as we do not observe objects that have not been added to the scene.
+   * This will be called if an actor is added to the scene.
    * @param[in] object The object object.
    * @see Object::Observer::SceneObjectAdded()
    */
-  virtual void SceneObjectAdded(Object& object) { }
+  virtual void SceneObjectAdded( Object& object );
 
   /**
-   * This will be called when the actor is removed from the stage, we should clear and stop
-   * observing it.
+   * This will be called when the actor is removed from the scene.
    * @param[in] object The object object.
    * @see Object::Observer::SceneObjectRemoved()
    */
-  virtual void SceneObjectRemoved(Object& object);
+  virtual void SceneObjectRemoved( Object& object );
 
   /**
    * This will be called when the actor is destroyed. We should clear the actor.
    * No need to stop observing as the object is being destroyed anyway.
    * @see Object::Observer::ObjectDestroyed()
    */
-  virtual void ObjectDestroyed(Object& object);
+  virtual void ObjectDestroyed( Object& object );
 
 private:
   Actor* mActor;                 ///< Raw pointer to an Actor.
index bb9291d..f685837 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -124,14 +124,14 @@ struct ActorTouchableCheck : public HitTestInterface
  */
 bool IsActorExclusiveToAnotherRenderTask( const Actor& actor,
                                           const RenderTask& renderTask,
-                                          const Vector< RenderTaskList::Exclusive >& exclusives )
+                                          const RenderTaskList::ExclusivesContainer& exclusives )
 
 {
-  if( exclusives.Size() )
+  if( exclusives.size() )
   {
-    for( Vector< RenderTaskList::Exclusive >::Iterator exclusiveIt = exclusives.Begin(); exclusives.End() != exclusiveIt; ++exclusiveIt )
+    for( const auto& exclusive : exclusives )
     {
-      if( ( exclusiveIt->renderTaskPtr != &renderTask ) && ( exclusiveIt->actorPtr == &actor ) )
+      if( ( exclusive.renderTaskPtr != &renderTask ) && ( exclusive.actor.GetActor() == &actor ) )
       {
         return true;
       }
@@ -151,7 +151,7 @@ bool IsActorExclusiveToAnotherRenderTask( const Actor& actor,
  */
 HitActor HitTestWithinLayer( Actor& actor,
                              const RenderTask& renderTask,
-                             const Vector< RenderTaskList::Exclusive >& exclusives,
+                             const RenderTaskList::ExclusivesContainer& exclusives,
                              const Vector4& rayOrigin,
                              const Vector4& rayDir,
                              float& nearClippingPlane,
@@ -401,7 +401,7 @@ void GetCameraClippingPlane( RenderTask& renderTask, float& nearClippingPlane, f
 /**
  * Hit test a RenderTask
  */
-bool HitTestRenderTask( const Vector< RenderTaskList::Exclusive >& exclusives,
+bool HitTestRenderTask( const RenderTaskList::ExclusivesContainer& exclusives,
                         const Vector2& sceneSize,
                         LayerList& layers,
                         RenderTask& renderTask,
@@ -541,7 +541,7 @@ bool HitTestRenderTaskList( const Vector2& sceneSize,
 {
   RenderTaskList::RenderTaskContainer& tasks = taskList.GetTasks();
   RenderTaskList::RenderTaskContainer::reverse_iterator endIter = tasks.rend();
-  const Vector< RenderTaskList::Exclusive >& exclusives = taskList.GetExclusivesList();
+  const auto& exclusives = taskList.GetExclusivesList();
 
   for( RenderTaskList::RenderTaskContainer::reverse_iterator iter = tasks.rbegin(); endIter != iter; ++iter )
   {
@@ -634,24 +634,6 @@ bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerLis
   return HitTest( sceneSize, renderTaskList, layerList, screenCoordinates, results, actorTouchableCheck );
 }
 
-bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, RenderTask& renderTask, const Vector2& screenCoordinates,
-              Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func )
-{
-  bool wasHit( false );
-  Results hitTestResults;
-
-  const Vector< RenderTaskList::Exclusive >& exclusives = renderTaskList.GetExclusivesList();
-  HitTestFunctionWrapper hitTestFunctionWrapper( func );
-  if( HitTestRenderTask( exclusives, sceneSize, layerList, renderTask, screenCoordinates, hitTestResults, hitTestFunctionWrapper ) )
-  {
-    results.actor = hitTestResults.actor;
-    results.actorCoordinates = hitTestResults.actorCoordinates;
-    wasHit = true;
-  }
-  return wasHit;
-}
-
-
 } // namespace HitTestAlgorithm
 
 } // namespace Internal
index bf16b93..a5d5f23 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_HIT_TEST_ALGORITHM_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -150,22 +150,6 @@ bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerLis
  */
 bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results );
 
-/**
- * Hit test specific to a given RenderTask
- *
- * @param[in] sceneSize The size of the scene.
- * @param[in] renderTaskList The render task list of the scene.
- * @param[in] layerList The layer list of the scene.
- * @param[in] renderTask The render task for hit test
- * @param[in] screenCoordinates The screen coordinates.
- * @param[out] results The results of the hit-test.
- * @param[in] func The function to use in the hit-test algorithm.
- * @return true if something was hit
- */
-bool HitTest( const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, RenderTask& renderTask, const Vector2& screenCoordinates,
-              Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func );
-
-
 } // namespace HitTestAlgorithm
 
 } // namespace Internal
index 96e454b..2ae57e8 100755 (executable)
@@ -81,11 +81,11 @@ void RenderTaskList::RemoveTask( Internal::RenderTask& task )
       // send a message to remove the scene-graph RenderTask
       RemoveTaskMessage( mEventThreadServices, *mSceneObject, sceneObject );
 
-      for ( Vector< Exclusive >::Iterator exclusiveIt = mExclusives.Begin(); exclusiveIt != mExclusives.End(); ++exclusiveIt )
+      for ( auto exclusiveIt = mExclusives.begin(); exclusiveIt != mExclusives.end(); ++exclusiveIt )
       {
         if ( exclusiveIt->renderTaskPtr == ptr )
         {
-          mExclusives.Erase( exclusiveIt );
+          mExclusives.erase( exclusiveIt );
           break;
         }
       }
@@ -109,18 +109,18 @@ RenderTaskPtr RenderTaskList::GetTask( uint32_t index ) const
 void RenderTaskList::SetExclusive( RenderTask* task, bool exclusive )
 {
   // Check to see if this rendertask has an entry?
-  for ( Vector< Exclusive >::Iterator exclusiveIt = mExclusives.Begin(); exclusiveIt != mExclusives.End(); ++exclusiveIt )
+  for ( auto exclusiveIt = mExclusives.begin(); exclusiveIt != mExclusives.end(); ++exclusiveIt )
   {
     if ( exclusiveIt->renderTaskPtr == task )
     {
       if ( !exclusive )
       {
-        mExclusives.Erase( exclusiveIt );
+        mExclusives.erase( exclusiveIt );
         break;
       }
       else
       {
-        exclusiveIt->actorPtr = task->GetSourceActor();
+        exclusiveIt->actor.SetActor( task->GetSourceActor() );
         exclusive = false;
         break;
       }
@@ -130,8 +130,8 @@ void RenderTaskList::SetExclusive( RenderTask* task, bool exclusive )
   {
     Exclusive exclusiveSlot;
     exclusiveSlot.renderTaskPtr = task;
-    exclusiveSlot.actorPtr = task->GetSourceActor();
-    mExclusives.PushBack( exclusiveSlot );
+    exclusiveSlot.actor.SetActor( task->GetSourceActor() );
+    mExclusives.emplace_back( std::move( exclusiveSlot ) );
   }
 }
 
index cef6a29..068a42f 100644 (file)
@@ -24,6 +24,7 @@
 #include <dali/public-api/render-tasks/render-task-list.h>
 #include <dali/internal/event/common/complete-notification-interface.h>
 #include <dali/internal/event/render-tasks/render-task-impl.h>
+#include <dali/internal/event/events/actor-observer.h>
 
 namespace Dali
 {
@@ -59,9 +60,11 @@ public:
   struct Exclusive
   {
     RenderTask* renderTaskPtr;        ///< Pointer for comparison with current rendertask.
-    Actor* actorPtr;                  ///< Pointer for comparison with current actor.
+    ActorObserver actor;              ///< For comparison with current actor.
   };
 
+  using ExclusivesContainer = std::vector< Exclusive >;
+
   /**
    * Create a RenderTaskList.
    * @return A newly allocated RenderTaskList; the caller takes ownership.
@@ -121,7 +124,7 @@ public:
    *
    * @return [description]
    */
-  const Vector< Exclusive >& GetExclusivesList() const
+  const ExclusivesContainer& GetExclusivesList() const
   {
     return mExclusives;
   }
@@ -178,7 +181,7 @@ private:
   SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
 
   RenderTaskContainer mTasks;           ///< Reference counted render-tasks
-  Vector< Exclusive > mExclusives;      ///< List of rendertasks with exclusively owned source actors.
+  ExclusivesContainer mExclusives;      ///< List of rendertasks with exclusively owned source actors.
 };
 
 } // namespace Internal