[Tizen] Add screen and client rotation itself function
[platform/core/uifw/dali-adaptor.git] / dali / integration-api / adaptor-framework / scene-holder-impl.h
index 10051b9..664a344 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
 // EXTERNAL INCLUDES
 #include <memory>
 #include <vector>
+#include <atomic>
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/math/uint-16-pair.h>
 #include <dali/integration-api/scene.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/point.h>
@@ -105,15 +107,22 @@ public:
   Dali::Integration::Scene GetScene();
 
   /**
+   * @brief Retrieves the DPI of this sceneholder.
+   * @return The DPI.
+   */
+  Uint16Pair GetDpi() const;
+
+  /**
    * @brief Set the render surface
    * @param[in] surface The render surface
    */
   void SetSurface( Dali::RenderSurfaceInterface* surface );
 
   /**
-   * @brief Called when the surface set is resized.
+   * @brief Called when the surface is resized.
+   * @param[in] forceUpdate The flag to update force
    */
-  void SurfaceResized();
+  void SurfaceResized( bool forceUpdate );
 
   /**
    * @brief Get the render surface
@@ -148,6 +157,13 @@ public:
   void Resume();
 
   /**
+   * @brief Checks whether this scene holder is being deleted in the event thread.
+   *
+   * @return true if this scene holder is being deleted in the event thread, or false if not.
+   */
+  bool IsBeingDeleted() const { return mIsBeingDeleted; }
+
+  /**
    * @copydoc Dali::Integration::SceneHolder::FeedTouchPoint
    */
   void FeedTouchPoint( Dali::Integration::Point& point, int timeStamp );
@@ -163,6 +179,38 @@ public:
   void FeedKeyEvent( Dali::Integration::KeyEvent& keyEvent );
 
   /**
+   * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
+   *
+   * @param[in] callback The function to call
+   * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
+   *
+   * @note A callback of the following type may be used:
+   * @code
+   *   void MyFunction( int frameId );
+   * @endcode
+   * This callback will be deleted once it is called.
+   *
+   * @note Ownership of the callback is passed onto this class.
+   */
+  void AddFrameRenderedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId );
+
+  /**
+   * @brief Adds a callback that is called when the frame rendering is done by the graphics driver.
+   *
+   * @param[in] callback The function to call
+   * @param[in] frameId The Id to specify the frame. It will be passed when the callback is called.
+   *
+   * @note A callback of the following type may be used:
+   * @code
+   *   void MyFunction( int frameId );
+   * @endcode
+   * This callback will be deleted once it is called.
+   *
+   * @note Ownership of the callback is passed onto this class.
+   */
+  void AddFramePresentedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId );
+
+  /**
    * @copydoc Dali::Integration::SceneHolder::Get()
    */
   static Dali::Integration::SceneHolder Get( Dali::Actor actor );
@@ -255,6 +303,11 @@ private:
    */
   void Reset();
 
+  /**
+   * Initializes the DPI for this object.
+   */
+  void InitializeDpi();
+
 private:
 
   static uint32_t                                 mSceneHolderCounter; ///< A counter to track the SceneHolder creation
@@ -273,6 +326,11 @@ protected:
 
   Dali::Integration::TouchEventCombiner           mCombiner;           ///< Combines multi-touch events.
 
+
+  Uint16Pair                                      mDpi;                ///< The DPI for this SceneHolder.
+
+  std::atomic<bool>                               mIsBeingDeleted;     ///< This is set only from the event thread and read only from the render thread
+
   bool                                            mAdaptorStarted:1;   ///< Whether the adaptor has started or not
   bool                                            mVisible:1;          ///< Whether the scene is visible or not
 };