Fix race-condition when window is resized or rotated. 70/281870/9
authorWonsik Jung <sidein@samsung.com>
Thu, 22 Sep 2022 21:45:00 +0000 (06:45 +0900)
committerWonsik Jung <sidein@samsung.com>
Mon, 24 Oct 2022 12:09:02 +0000 (21:09 +0900)
Internal dali window module has some variables and flags.
They are set by both main thread and render thread.
It has the effect of race condition when window is resized or rotated serval times.
This patch is to fix them.

Change-Id: I63ecc4a5d711569323a8f055e3b46ae878126235

automated-tests/src/dali/utc-Dali-RenderTask.cpp
automated-tests/src/dali/utc-Dali-Scene.cpp
dali/integration-api/scene.cpp
dali/integration-api/scene.h
dali/internal/event/common/scene-impl.cpp
dali/internal/event/common/scene-impl.h
dali/internal/update/common/scene-graph-scene.cpp
dali/internal/update/common/scene-graph-scene.h

index e625d29e2b15e597cf1041581904a72bd52cdfee..e3857dcb4255923861766774fde0f8498860f4ff 100644 (file)
@@ -3666,9 +3666,9 @@ int UtcDaliRenderTaskViewportGuideActor02(void)
   renderTask.SetSourceActor(blue);
   renderTask.SetViewportGuideActor(blue);
 
-  application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_HEIGHT,
-                                        TestApplication::DEFAULT_SURFACE_WIDTH,
-                                        90);
+  application.GetScene().SurfaceRotated(static_cast<float>(TestApplication::DEFAULT_SURFACE_HEIGHT),
+                                        static_cast<float>(TestApplication::DEFAULT_SURFACE_WIDTH),
+                                        90, 0);
 
   // Render and notify
   application.SendNotification();
@@ -3682,4 +3682,4 @@ int UtcDaliRenderTaskViewportGuideActor02(void)
   DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams2) >= 0);
 
   END_TEST;
-}
\ No newline at end of file
+}
index 37e3854dd05969c164b503f30b6750405bb19a63..e4e0369276a0fb3d83ac2d04d542cbde75cac36a 100644 (file)
@@ -1172,18 +1172,21 @@ int UtcDaliSceneSurfaceRotatedWithAngle0(void)
   actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
   application.GetScene().Add(actor);
 
+  // consume the orientating changing flag by first rendering
   application.SendNotification();
 
   damagedRects.clear();
   application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_WIDTH,
                                         TestApplication::DEFAULT_SURFACE_HEIGHT,
-                                        0);
+                                        0, 0);
 
-  // Check current surface orientation
+  // Check current orientations
   int32_t orientation = application.GetScene().GetCurrentSurfaceOrientation();
+  int32_t screenOrientation = application.GetScene().GetCurrentScreenOrientation();
 
   // It should not be changed yet.
   DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+  DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
 
   application.SendNotification();
   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
@@ -1198,11 +1201,13 @@ int UtcDaliSceneSurfaceRotatedWithAngle0(void)
   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
 
-  // Check current surface orientation
+  // Check current orientations
   orientation = application.GetScene().GetCurrentSurfaceOrientation();
+  screenOrientation = application.GetScene().GetCurrentScreenOrientation();
 
   // It should be changed.
   DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+  DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
 
   END_TEST;
 }
@@ -1243,13 +1248,15 @@ int UtcDaliSceneSurfaceRotatedWithAngle90(void)
   damagedRects.clear();
   application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_WIDTH,
                                         TestApplication::DEFAULT_SURFACE_HEIGHT,
-                                        90);
+                                        90, 90);
 
   // Check current surface orientation
   int32_t orientation = application.GetScene().GetCurrentSurfaceOrientation();
+  int32_t screenOrientation = application.GetScene().GetCurrentScreenOrientation();
 
   // It should not be changed yet.
   DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+  DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
 
   application.SendNotification();
   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
@@ -1271,11 +1278,13 @@ int UtcDaliSceneSurfaceRotatedWithAngle90(void)
   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
 
-  // Check current surface orientation
+  // Check current orientations
   orientation = application.GetScene().GetCurrentSurfaceOrientation();
+  screenOrientation = application.GetScene().GetCurrentScreenOrientation();
 
   // It should be changed.
   DALI_TEST_EQUALS(orientation, 90, TEST_LOCATION);
+  DALI_TEST_EQUALS(screenOrientation, 90, TEST_LOCATION);
 
   END_TEST;
 }
@@ -1316,13 +1325,15 @@ int UtcDaliSceneSurfaceRotatedWithAngle180(void)
   damagedRects.clear();
   application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_WIDTH,
                                         TestApplication::DEFAULT_SURFACE_HEIGHT,
-                                        180);
+                                        180, 180);
 
   // Check current surface orientation
   int32_t orientation = application.GetScene().GetCurrentSurfaceOrientation();
+  int32_t screenOrientation = application.GetScene().GetCurrentScreenOrientation();
 
   // It should not be changed yet.
   DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+  DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
 
   application.SendNotification();
   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
@@ -1344,11 +1355,13 @@ int UtcDaliSceneSurfaceRotatedWithAngle180(void)
   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
 
-  // Check current surface orientation
+  // Check current orientations
   orientation = application.GetScene().GetCurrentSurfaceOrientation();
+  screenOrientation = application.GetScene().GetCurrentScreenOrientation();
 
   // It should be changed.
   DALI_TEST_EQUALS(orientation, 180, TEST_LOCATION);
+DALI_TEST_EQUALS(screenOrientation, 180, TEST_LOCATION);
 
   END_TEST;
 }
@@ -1389,13 +1402,15 @@ int UtcDaliSceneSurfaceRotatedWithAngle270(void)
   damagedRects.clear();
   application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_WIDTH,
                                         TestApplication::DEFAULT_SURFACE_HEIGHT,
-                                        270);
+                                        270, 270);
 
   // Check current surface orientation
   int32_t orientation = application.GetScene().GetCurrentSurfaceOrientation();
+  int32_t screenOrientation = application.GetScene().GetCurrentScreenOrientation();
 
   // It should not be changed yet.
   DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+  DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
 
   application.SendNotification();
   application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
@@ -1417,11 +1432,13 @@ int UtcDaliSceneSurfaceRotatedWithAngle270(void)
   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
 
-  // Check current surface orientation
+  // Check current orientations
   orientation = application.GetScene().GetCurrentSurfaceOrientation();
+  screenOrientation = application.GetScene().GetCurrentScreenOrientation();
 
   // It should be changed.
   DALI_TEST_EQUALS(orientation, 270, TEST_LOCATION);
+  DALI_TEST_EQUALS(screenOrientation, 270, TEST_LOCATION);
 
   END_TEST;
 }
@@ -1460,13 +1477,15 @@ int UtcDaliSceneSetRotationCompletedAcknowledgementWithAngle90(void)
   damagedRects.clear();
   application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_WIDTH,
                                         TestApplication::DEFAULT_SURFACE_HEIGHT,
-                                        90);
+                                        90, 90);
 
   // Check current surface orientation
   int32_t orientation = application.GetScene().GetCurrentSurfaceOrientation();
+  int32_t screenOrientation = application.GetScene().GetCurrentScreenOrientation();
 
   // It should not be changed yet.
   DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+  DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
 
   application.GetScene().SetRotationCompletedAcknowledgement();
 
@@ -1490,11 +1509,13 @@ int UtcDaliSceneSetRotationCompletedAcknowledgementWithAngle90(void)
   DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
   DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
 
-  // Check current surface orientation
+  // Check current orientations
   orientation = application.GetScene().GetCurrentSurfaceOrientation();
+  screenOrientation = application.GetScene().GetCurrentScreenOrientation();
 
   // It should be changed.
   DALI_TEST_EQUALS(orientation, 90, TEST_LOCATION);
+  DALI_TEST_EQUALS(screenOrientation, 90, TEST_LOCATION);
 
   bool isSetRotationCompletedAcknowledgementSet = application.GetScene().IsRotationCompletedAcknowledgementSet();
   DALI_TEST_EQUALS(isSetRotationCompletedAcknowledgementSet, true, TEST_LOCATION);
@@ -1561,7 +1582,7 @@ int UtcDaliSceneSurfaceRotatedPartialUpdate(void)
   // Rotate surface
   application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_HEIGHT,
                                         TestApplication::DEFAULT_SURFACE_WIDTH,
-                                        90);
+                                        90, 0);
 
   damagedRects.clear();
 
index 28dbe68202df141c535dd402c76ee4b81d8872da..cce626d23ce84aff064cf1264e5ece796270debf 100644 (file)
@@ -30,9 +30,9 @@ namespace Dali
 {
 namespace Integration
 {
-Scene Scene::New(Size size, int32_t orientation)
+Scene Scene::New(Size size, int32_t windowOrientation, int32_t screenOrientation)
 {
-  Internal::ScenePtr internal = Internal::Scene::New(size, orientation);
+  Internal::ScenePtr internal = Internal::Scene::New(size, windowOrientation, screenOrientation);
   return Scene(internal.Get());
 }
 
@@ -164,9 +164,9 @@ void Scene::GetFramePresentedCallback(FrameCallbackContainer& callbacks)
   GetImplementation(*this).GetFramePresentedCallback(callbacks);
 }
 
-void Scene::SurfaceRotated(float width, float height, int32_t orientation)
+void Scene::SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation)
 {
-  GetImplementation(*this).SurfaceRotated(width, height, orientation);
+  GetImplementation(*this).SurfaceRotated(width, height, windowOrientation, screenOrientation);
 }
 
 int32_t Scene::GetCurrentSurfaceOrientation() const
@@ -174,6 +174,11 @@ int32_t Scene::GetCurrentSurfaceOrientation() const
   return GetImplementation(*this).GetCurrentSurfaceOrientation();
 }
 
+int32_t Scene::GetCurrentScreenOrientation() const
+{
+  return GetImplementation(*this).GetCurrentScreenOrientation();
+}
+
 const Rect<int32_t>& Scene::GetCurrentSurfaceRect() const
 {
   return GetImplementation(*this).GetCurrentSurfaceRect();
index 8b463ec5ed2d62f223c9a369f02d34ce1e8b89b7..bdaf814850495abc1eabf2b8c868da4df85022ce 100644 (file)
@@ -74,11 +74,12 @@ public:
    * @brief Create an initialized Scene handle.
    *
    * @param[in] size The size of the set surface for this scene
-   * @param[in] orientation The rotated angle of the set surface for this scene
+   * @param[in] windowOrientation The rotated angle of the set surface for this scene
+   * @param[in] screenOrientation The rotated angle of the screen
    *
    * @return a handle to a newly allocated Dali resource.
    */
-  static Scene New(Size size, int32_t orientation = 0);
+  static Scene New(Size size, int32_t windowOrientation = 0, int32_t screenOrientation = 0);
 
   /**
    * @brief Downcast an Object handle to Scene handle.
@@ -304,9 +305,10 @@ public:
    *
    * @param[in] width The width of rotated surface
    * @param[in] height The height of rotated surface
-   * @param[in] orientation The orientation of rotated surface
+   * @param[in] windowOrientation the current window orientation
+   * @param[in] screenOrientation the current screen orientation
    */
-  void SurfaceRotated(float width, float height, int32_t orientation);
+  void SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation);
 
   /**
    * @brief Gets the current surface orientation. It gets the value from the scene object.
@@ -315,6 +317,13 @@ public:
    */
   int32_t GetCurrentSurfaceOrientation() const;
 
+  /**
+   * @brief Gets the current screen orientation. It gets the value from the scene object.
+   *
+   * @return The current screen orientation.
+   */
+  int32_t GetCurrentScreenOrientation() const;
+
   /**
    * @brief Gets the current surface rectangle. It gets the value from the scene object.
    *
index cdec748736c8e324ac515fa4208f9e363e94d6bf..ea5c689320b355cc9be86193fcd33d5d11f644e2 100644 (file)
@@ -41,12 +41,12 @@ namespace Dali
 {
 namespace Internal
 {
-ScenePtr Scene::New(Size size, int32_t orientation)
+ScenePtr Scene::New(Size size, int32_t windowOrientation, int32_t screenOrientation)
 {
   ScenePtr scene = new Scene;
 
   // Second-phase construction
-  scene->Initialize(size, orientation);
+  scene->Initialize(size, windowOrientation, screenOrientation);
 
   return scene;
 }
@@ -58,7 +58,8 @@ Scene::Scene()
   mBackgroundColor(DEFAULT_BACKGROUND_COLOR),
   mDepthTreeDirty(false),
   mEventProcessor(*this, ThreadLocalStorage::GetInternal()->GetGestureEventProcessor()),
-  mSurfaceOrientation(0)
+  mSurfaceOrientation(0),
+  mScreenOrientation(0)
 {
 }
 
@@ -93,7 +94,7 @@ Scene::~Scene()
   // When this destructor is called, the scene has either already been removed from Core or Core has already been destroyed
 }
 
-void Scene::Initialize(Size size, int32_t orientation)
+void Scene::Initialize(Size size, int32_t windowOrientation, int32_t screenOrientation)
 {
   ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
 
@@ -135,7 +136,7 @@ void Scene::Initialize(Size size, int32_t orientation)
   OwnerPointer<SceneGraph::Scene> transferOwnership(const_cast<SceneGraph::Scene*>(mSceneObject));
   AddSceneMessage(updateManager, transferOwnership);
 
-  SurfaceRotated(size.width, size.height, orientation);
+  SurfaceRotated(size.width, size.height, windowOrientation, screenOrientation);
 }
 
 void Scene::Add(Actor& actor)
@@ -202,7 +203,7 @@ void Scene::SurfaceResized(float width, float height)
 {
   if((fabsf(mSize.width - width) > Math::MACHINE_EPSILON_1) || (fabsf(mSize.height - height) > Math::MACHINE_EPSILON_1))
   {
-    ChangedSurface(width, height, mSurfaceOrientation);
+    ChangedSurface(width, height, mSurfaceOrientation, mScreenOrientation);
   }
 }
 
@@ -277,10 +278,9 @@ void Scene::EmitKeyEventSignal(const Dali::KeyEvent& event)
   }
 }
 
-void Scene::SurfaceRotated(float width, float height, int32_t orientation)
+void Scene::SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation)
 {
-  mSurfaceOrientation = orientation;
-  ChangedSurface(width, height, orientation);
+  ChangedSurface(width, height, windowOrientation, screenOrientation);
 }
 
 int32_t Scene::GetCurrentSurfaceOrientation() const
@@ -288,28 +288,51 @@ int32_t Scene::GetCurrentSurfaceOrientation() const
   return mSceneObject->GetSurfaceOrientation();
 }
 
+int32_t Scene::GetCurrentScreenOrientation() const
+{
+  return mSceneObject->GetScreenOrientation();
+}
+
 const Rect<int32_t>& Scene::GetCurrentSurfaceRect() const
 {
   return mSceneObject->GetSurfaceRect();
 }
 
-void Scene::ChangedSurface(float width, float height, int32_t orientation)
+void Scene::ChangedSurface(float width, float height, int32_t windowOrientation, int32_t screenOrientation)
 {
+  bool changedOrientation = false;
   Rect<int32_t> newSize(0, 0, static_cast<int32_t>(width), static_cast<int32_t>(height)); // truncated
   mSize.width  = width;
   mSize.height = height;
 
+  if(mSurfaceOrientation != windowOrientation || mScreenOrientation != screenOrientation)
+  {
+    changedOrientation = true;
+  }
+
+  mSurfaceOrientation = windowOrientation;
+  mScreenOrientation = screenOrientation;
+
   // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
   mDefaultCamera->SetPerspectiveProjection(mSize);
   // Set the surface orientation to Default camera for window/screen rotation
-  mDefaultCamera->RotateProjection(orientation);
+  if(changedOrientation)
+  {
+    int32_t orientation = (windowOrientation + screenOrientation) % 360;
+    mDefaultCamera->RotateProjection(orientation);
+  }
 
   mRootLayer->SetSize(width, height);
 
   // Send the surface rectangle/orientation to SceneGraph::Scene for calculating glViewport/Scissor
   ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
+  DALI_LOG_RELEASE_INFO("Send Surface Rect Message, width[%d], height[%d]\n", newSize.width, newSize.height);
   SetSurfaceRectMessage(tls->GetEventThreadServices(), *mSceneObject, newSize);
-  SetSurfaceOrientationMessage(tls->GetEventThreadServices(), *mSceneObject, static_cast<int32_t>(orientation));
+  if(changedOrientation)
+  {
+    DALI_LOG_RELEASE_INFO("Send Surface Orientation Message, surface orientation[%d], screen orientation[%d]\n", mSurfaceOrientation, mScreenOrientation);
+    SetSurfaceOrientationsMessage(tls->GetEventThreadServices(), *mSceneObject, mSurfaceOrientation, mScreenOrientation);
+  }
 
   // set default render-task viewport parameters
   RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask(0u);
index 182ed0fa07ca4b2d1feb1c166a097c6e3c082802..52ea3560582a0a50fd1f3fbefd3c65a05e1d3dd4 100644 (file)
@@ -62,7 +62,7 @@ public:
   /**
    * @copydoc Dali::Integration::Scene::New
    */
-  static ScenePtr New(Size size, int32_t orientation = 0);
+  static ScenePtr New(Size size, int32_t windowOrientation = 0, int32_t screenOrientation = 0);
 
   /**
    * virtual destructor
@@ -186,9 +186,10 @@ public:
    *
    * @param[in] width The width of rotated surface
    * @param[in] height The height of rotated surface
-   * @param[in] orientation The orientation of rotated surface
+   * @param[in] windowOrientation the current window orientation
+   * @param[in] screenOrientation the current screen orientation
    */
-  void SurfaceRotated(float width, float height, int32_t orientation);
+  void SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation);
 
   /**
    * @copydoc Dali::Integration::Scene::SetRotationCompletedAcknowledgement
@@ -205,6 +206,11 @@ public:
    */
   int32_t GetCurrentSurfaceOrientation() const;
 
+  /**
+   * @copydoc Dali::Integration::Scene::GetCurrentScreenOrientation
+   */
+  int32_t GetCurrentScreenOrientation() const;
+
   /**
    * @copydoc Dali::Integration::Scene::GetCurrentSurfaceRect
    */
@@ -342,9 +348,10 @@ private:
    * Second-phase constructor.
    *
    * @param[in] size The size of the set surface
-   * @param[in] orientation The orientation of the set surface for this scene
+   * @param[in] windowOrientation The rotated angle of the set surface for this scene
+   * @param[in] screenOrientation The rotated angle of the screen
    */
-  void Initialize(Size size, int32_t orientation);
+  void Initialize(Size size, int32_t windowOrientation, int32_t screenOrientation);
 
   // Undefined
   Scene(const Scene&) = delete;
@@ -357,9 +364,10 @@ private:
    *
    * @param[in] width The width of rotated surface
    * @param[in] height The height of rotated surface
-   * @param[in] orientation The orientation of rotated surface
+   * @param[in] windowOrientation the current window orientation
+   * @param[in] screenOrientation the current screen orientation
    */
-  void ChangedSurface(float width, float height, int32_t orientation);
+  void ChangedSurface(float width, float height, int32_t windowOrientation, int32_t screenOrientation);
 
 private:
   Internal::SceneGraph::Scene* mSceneObject;
@@ -387,6 +395,9 @@ private:
   // The Surface's orientation
   int32_t mSurfaceOrientation;
 
+  // The Screen's orientation
+  int32_t mScreenOrientation;
+
   // The key event signal
   Integration::Scene::KeyEventSignalType          mKeyEventSignal;
   Integration::Scene::KeyEventGeneratedSignalType mKeyEventGeneratedSignal;
index 30676f70427eef0c0678c5cb4582268dd8c740e0..198299aeb658096c76ac7bff77ae53f7617e81ad 100644 (file)
@@ -33,6 +33,7 @@ Scene::Scene()
   mSkipRendering(false),
   mSurfaceRect(),
   mSurfaceOrientation(0),
+  mScreenOrientation(0),
   mSurfaceRectChanged(false),
   mRotationCompletedAcknowledgement(false)
 {
@@ -151,6 +152,8 @@ void Scene::SetSurfaceRect(const Rect<int32_t>& rect)
   mSurfaceRect        = rect;
   mSurfaceRectChanged = true;
 
+  DALI_LOG_RELEASE_INFO("update surfce rect in scene-graph, width[%d], height[%d]\n", mSurfaceRect.width, mSurfaceRect.height);
+
   if(mRoot)
   {
     mRoot->SetUpdated(true);
@@ -162,14 +165,25 @@ const Rect<int32_t>& Scene::GetSurfaceRect() const
   return mSurfaceRect;
 }
 
-void Scene::SetSurfaceOrientation(int32_t orientation)
+bool Scene::IsSurfaceRectChanged()
 {
-  mSurfaceOrientation = orientation;
+  bool surfaceRectChanged = mSurfaceRectChanged;
+  mSurfaceRectChanged     = false;
+
+  return surfaceRectChanged;
+}
+
+void Scene::SetSurfaceOrientations(int32_t windowOrientation, int32_t screenOrienation)
+{
+  mSurfaceOrientation = windowOrientation;
+  mScreenOrientation = screenOrienation;
 
   if(mRoot)
   {
     mRoot->SetUpdated(true);
   }
+
+  DALI_LOG_RELEASE_INFO("update orientation in scene-graph, surface [%d], screen[%d]\n", mSurfaceOrientation, mScreenOrientation);
 }
 
 int32_t Scene::GetSurfaceOrientation() const
@@ -177,12 +191,9 @@ int32_t Scene::GetSurfaceOrientation() const
   return mSurfaceOrientation;
 }
 
-bool Scene::IsSurfaceRectChanged()
+int32_t Scene::GetScreenOrientation() const
 {
-  bool surfaceRectChanged = mSurfaceRectChanged;
-  mSurfaceRectChanged     = false;
-
-  return surfaceRectChanged;
+  return mScreenOrientation;
 }
 
 void Scene::SetRotationCompletedAcknowledgement()
index cca0106441b3716f3ad1a2f213987247d68707db..8d5339ea0e7fd5021825abc0c9beb2d67f7445ec 100644 (file)
@@ -173,11 +173,12 @@ public:
   const Rect<int32_t>& GetSurfaceRect() const;
 
   /**
-   * Set the surface orientation when surface is rotated.
+   * Set the surface orientations when surface or screen is rotated.
    *
-   * @param[in] orientation The orientation value representing the surface.
+   * @param[in] windowOrientation The orientations value representing surface.
+   * @param[in] screenOrienation The orientations value representing screen.
    */
-  void SetSurfaceOrientation(int32_t orientation);
+  void SetSurfaceOrientations(int32_t windowOrientation, int32_t screenOrienation);
 
   /**
    * Get the surface orientation.
@@ -186,6 +187,13 @@ public:
    */
   int32_t GetSurfaceOrientation() const;
 
+  /**
+   * Get the screen orientation.
+   *
+   * @return the current screen orientation
+   */
+  int32_t GetScreenOrientation() const;
+
   /**
    * Query wheter the surface rect is changed or not.
    * @return true if the surface rect is changed.
@@ -289,7 +297,8 @@ private:
 
   Rect<int32_t> mSurfaceRect;                      ///< The rectangle of surface which is related ot this scene.
   int32_t       mSurfaceOrientation;               ///< The orientation of surface which is related of this scene
-  bool          mSurfaceRectChanged;               ///< The flag of surface's rectangle is changed when is resized, moved or rotated.
+  int32_t       mScreenOrientation;                ///< The orientation of screen
+  bool          mSurfaceRectChanged;               ///< The flag of surface's rectangle is changed when is resized or moved.
   bool          mRotationCompletedAcknowledgement; ///< The flag of sending the acknowledgement to complete window rotation.
 
   // Render pass and render target
@@ -345,15 +354,15 @@ inline void SetSurfaceRectMessage(EventThreadServices& eventThreadServices, cons
   new(slot) LocalType(&scene, &Scene::SetSurfaceRect, rect);
 }
 
-inline void SetSurfaceOrientationMessage(EventThreadServices& eventThreadServices, const Scene& scene, int32_t orientation)
+inline void SetSurfaceOrientationsMessage(EventThreadServices& eventThreadServices, const Scene& scene, const int32_t windowOrientation, const int32_t screenOrientation)
 {
-  using LocalType = MessageValue1<Scene, int32_t>;
+  using LocalType = MessageValue2<Scene, int32_t, int32_t>;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new(slot) LocalType(&scene, &Scene::SetSurfaceOrientation, orientation);
+  new(slot) LocalType(&scene, &Scene::SetSurfaceOrientations, windowOrientation, screenOrientation);
 }
 
 inline void SetRotationCompletedAcknowledgementMessage(EventThreadServices& eventThreadServices, const Scene& scene)