X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fcommon%2Fscene-impl.h;h=44a5e3bbec71949e6bf626a6378a2e5f6afcffd2;hb=b192f4f14bad2da813b76387b6abc35411246be4;hp=b94175ac5c74f3d80c411f1044fa335f1942cec8;hpb=e97db75a88e0f5ea0f909222e92dc39f5a44f003;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/common/scene-impl.h b/dali/internal/event/common/scene-impl.h old mode 100644 new mode 100755 index b94175a..44a5e3b --- a/dali/internal/event/common/scene-impl.h +++ b/dali/internal/event/common/scene-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_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. @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -35,13 +34,66 @@ namespace Dali namespace Integration { -class Event; +struct Event; } namespace Internal { +namespace SceneGraph +{ +class Scene; + +struct DirtyRect +{ + DirtyRect(Node* node, Render::Renderer* renderer, int frame, Rect& rect) + : node(node), + renderer(renderer), + frame(frame), + rect(rect), + visited(true) + { + } + + DirtyRect() + : node(nullptr), + renderer(nullptr), + frame(0), + rect(), + visited(true) + { + } + + bool operator<(const DirtyRect& rhs) const + { + if (node == rhs.node) + { + if (renderer == rhs.renderer) + { + return frame > rhs.frame; // Most recent rects come first + } + else + { + return renderer < rhs.renderer; + } + } + else + { + return node < rhs.node; + } + } + + Node* node; + Render::Renderer* renderer; + int frame; + + Rect rect; + bool visited; +}; + +} + class EventProcessor; class Layer; class LayerList; @@ -62,12 +114,12 @@ public: /** * @copydoc Dali::Integration::Scene::New */ - static ScenePtr New( const Size& size ); + static ScenePtr New(Size size, int orientation = 0); /** * virtual destructor */ - virtual ~Scene(); + ~Scene() override; /** * @copydoc Dali::Integration::Scene::Add @@ -115,20 +167,22 @@ public: Dali::Layer GetLayer(uint32_t depth) const; /** - * @copydoc Dali::Integration::Scene::SetSurface + * Notify the surface has been resized. + * + * @param[in] width The new width of the set surface + * @param[in] height The new height of the set surface */ - void SetSurface( Integration::RenderSurface& surface ); + void SurfaceResized( float width, float height ); /** - * @copydoc Dali::Integration::Scene::Discard + * @copydoc Dali::Integration::Scene::SurfaceReplaced */ - void Discard(); + void SurfaceReplaced(); /** - * Retrieve the render surface the scene is binded to. - * @return The render surface. + * @copydoc Dali::Integration::Scene::Discard */ - Integration::RenderSurface* GetSurface() const; + void Discard(); /** * Retrieve the ordered list of on-scene layers. @@ -159,10 +213,10 @@ public: void RebuildDepthTree(); /** - * @brief Sets the background color of the render surface. + * @brief Sets the background color of the render surface. * @param[in] color The new background color */ - void SetBackgroundColor(Vector4 color); + void SetBackgroundColor( const Vector4& color ); /** * @brief Gets the background color of the render surface. @@ -171,10 +225,42 @@ public: Vector4 GetBackgroundColor() const; /** + * @brief Get the Scene scene graph object + * + * @return the Scene scene graph object + */ + SceneGraph::Scene* GetSceneObject() const; + + /** + * Notify the surface has been rotated. + * When the device is rotated or the rotation event is received by display manager, + * this function will be called by window implementation. + * + * @param[in] width The width of rotated surface + * @param[in] height The height of rotated surface + * @param[in] orientation The orientation of rotated surface + */ + void SurfaceRotated(float width, float height, int orientation); + + /** + * @brief Get surface's current orientation + * + * @return surface orientation + */ + int GetSurfaceOrientation(); + + /** * Used by the EventProcessor to emit key event signals. * @param[in] event The key event. */ - void EmitKeyEventSignal(const KeyEvent& event); + void EmitKeyEventSignal(const Dali::KeyEvent& event); + + /** + * Used by the KeyEventProcessor to emit KeyEventGenerated signals. + * @param[in] event The key event. + * @return The return is true if KeyEvent is consumed, otherwise false. + */ + bool EmitKeyEventGeneratedSignal(const Dali::KeyEvent& event); /** * Emits the event processing finished signal. @@ -185,68 +271,94 @@ public: /** * Emits the touched signal. - * @param[in] touchEvent The touch event details (Old API). * @param[in] touch The touch event details. */ - void EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch ); + void EmitTouchedSignal( const Dali::TouchEvent& touch ); /** * Used by the EventProcessor to emit wheel event signals. * @param[in] event The wheel event. */ - void EmitWheelEventSignal( const WheelEvent& event ); + void EmitWheelEventSignal( const Dali::WheelEvent& event ); /** - * @copydoc Integration::Scene::KeyEventSignal() + * @copydoc Dali::Integration::Scene::AddFrameRenderedCallback */ - Integration::Scene::KeyEventSignalType& KeyEventSignal(); + void AddFrameRenderedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId ); /** - * @copydoc Integration::Scene::SignalEventProcessingFinished() + * @copydoc Dali::Integration::Scene::AddFramePresentedCallback */ - Integration::Scene::EventProcessingFinishedSignalType& EventProcessingFinishedSignal(); + void AddFramePresentedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId ); + + /** + * @copydoc Dali::Integration::Scene::GetFrameRenderedCallback + */ + void GetFrameRenderedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks ); - // The touched signal, to support Stage touched signal, will be removed when deprecated in public Stage API - using TouchedSignalType = Signal< void (const TouchEvent&) >; + /** + * @copydoc Dali::Integration::Scene::GetFramePresentedCallback + */ + void GetFramePresentedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks ); /** - * Touched signal to support deprecated stage touched signal. + * @copydoc Integration::Scene::KeyEventSignal() + */ + Integration::Scene::KeyEventSignalType& KeyEventSignal(); + + /** + * @copydoc Integration::Scene::KeyEventGeneratedSignal() + */ + Integration::Scene::KeyEventGeneratedSignalType& KeyEventGeneratedSignal(); + + /** + * @copydoc Integration::Scene::SignalEventProcessingFinished() */ - TouchedSignalType& TouchedSignal(); + Integration::Scene::EventProcessingFinishedSignalType& EventProcessingFinishedSignal(); /** - * @copydoc Integration::Scene::TouchSignal() + * @copydoc Integration::Scene::TouchedSignal() */ - Integration::Scene::TouchSignalType& TouchSignal(); + Integration::Scene::TouchEventSignalType& TouchedSignal(); /** * @copydoc Integration::Scene::sWheelEventSignal() */ Integration::Scene::WheelEventSignalType& WheelEventSignal(); + /** + * @brief Get ItemsDirtyRects + * + * @return the ItemsDirtyRects + */ + std::vector& GetItemsDirtyRects(); + public: /** * From RenderTaskDefaults; retrieve the default root actor. * @return The default root actor. */ - virtual Actor& GetDefaultRootActor(); + Actor& GetDefaultRootActor() override; /** * From RenderTaskDefaults; retrieve the default camera actor. * @return The default camera actor. */ - virtual CameraActor& GetDefaultCameraActor(); + CameraActor& GetDefaultCameraActor() override; private: // Constructor - Scene( const Size& size ); + Scene(); /** * Second-phase constructor. + * + * @param[in] size The size of the set surface + * @param[in] orientation The orientation of the set surface for this scene */ - void Initialize(); + void Initialize(Size size, int orientation); // Undefined Scene(const Scene&) = delete; @@ -254,15 +366,24 @@ private: // Undefined Scene& operator=(const Scene& rhs) = delete; + /** + * Informs the scene that the set surface has been resized or rotated. + * + * @param[in] width The width of rotated surface + * @param[in] height The height of rotated surface + * @param[in] orientation The orientation of rotated surface + */ + void ChangedSurface(float width, float height, int orientation); + private: - Integration::RenderSurface* mSurface; + Internal::SceneGraph::Scene* mSceneObject; - // The scene-size may be different with the surface-size Size mSize; - Size mSurfaceSize; Vector2 mDpi; + Vector4 mBackgroundColor; + LayerPtr mRootLayer; // Ordered list of currently on-stage layers @@ -273,27 +394,27 @@ private: // The list of render-tasks IntrusivePtr mRenderTaskList; - // The frame buffer - FrameBufferPtr mFrameBuffer; - bool mDepthTreeDirty:1; ///< True if the depth tree needs recalculating EventProcessor mEventProcessor; + // The Surface's orientation + int mSurfaceOrientation; + // The key event signal Integration::Scene::KeyEventSignalType mKeyEventSignal; + Integration::Scene::KeyEventGeneratedSignalType mKeyEventGeneratedSignal; // The event processing finished signal Integration::Scene::EventProcessingFinishedSignalType mEventProcessingFinishedSignal; // The touch signal - Integration::Scene::TouchSignalType mTouchSignal; - - // The touched signal - TouchedSignalType mTouchedSignal; + Integration::Scene::TouchEventSignalType mTouchedSignal; // The wheel event signal Integration::Scene::WheelEventSignalType mWheelEventSignal; + + std::vector mItemsDirtyRects; }; } // Internal