#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.
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/integration-api/render-surface.h>
#include <dali/internal/common/owner-pointer.h>
#include <dali/internal/event/actors/layer-impl.h>
#include <dali/internal/event/events/event-processor.h>
namespace Integration
{
-class Event;
+struct Event;
}
namespace Internal
{
+namespace SceneGraph
+{
+class Scene;
+
+struct DirtyRect
+{
+ DirtyRect(Node* node, Render::Renderer* renderer, int frame, Rect<int>& 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<int> rect;
+ bool visited;
+};
+
+}
+
class EventProcessor;
class Layer;
class LayerList;
/**
* @copydoc Dali::Integration::Scene::New
*/
- static ScenePtr New( Integration::RenderSurface& surface );
+ static ScenePtr New( Size size );
/**
* virtual destructor
*/
- virtual ~Scene();
+ ~Scene() override;
/**
* @copydoc Dali::Integration::Scene::Add
Dali::Layer GetLayer(uint32_t depth) const;
/**
- * @copydoc Dali::Integration::Scene::SetSurface
- */
- void SetSurface( Integration::RenderSurface& surface );
-
- /**
* 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 SurfaceResized();
+ void SurfaceResized( float width, float height );
/**
- * Notify the surface has been deleted.
+ * @copydoc Dali::Integration::Scene::SurfaceReplaced
*/
- void SurfaceDeleted();
+ void SurfaceReplaced();
/**
* @copydoc Dali::Integration::Scene::Discard
void Discard();
/**
- * Retrieve the render surface the scene is binded to.
- * @return The render surface.
- */
- Integration::RenderSurface* GetSurface() const;
-
- /**
* Retrieve the ordered list of on-scene layers.
* @return The layer-list.
*/
Vector4 GetBackgroundColor() const;
/**
+ * @brief Get the Scene scene graph object
+ *
+ * @return the Scene scene graph object
+ */
+ SceneGraph::Scene* GetSceneObject() const;
+
+ /**
* 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 KeyEvent& event);
+ bool EmitKeyEventGeneratedSignal(const Dali::KeyEvent& event);
/**
* Emits the event processing finished signal.
/**
* 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 Dali::Integration::Scene::AddFrameRenderedCallback
+ */
+ void AddFrameRenderedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId );
+
+ /**
+ * @copydoc Dali::Integration::Scene::AddFramePresentedCallback
+ */
+ void AddFramePresentedCallback( std::unique_ptr< CallbackBase > callback, int32_t frameId );
+
+ /**
+ * @copydoc Dali::Integration::Scene::GetFrameRenderedCallback
+ */
+ void GetFrameRenderedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks );
+
+ /**
+ * @copydoc Dali::Integration::Scene::GetFramePresentedCallback
+ */
+ void GetFramePresentedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks );
/**
* @copydoc Integration::Scene::KeyEventSignal()
*/
Integration::Scene::EventProcessingFinishedSignalType& EventProcessingFinishedSignal();
- // The touched signal, to support Stage touched signal, will be removed when deprecated in public Stage API
- using TouchedSignalType = Signal< void (const TouchEvent&) >;
-
/**
- * Touched signal to support deprecated stage touched signal.
- */
- TouchedSignalType& TouchedSignal();
-
- /**
- * @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<Dali::Internal::SceneGraph::DirtyRect>& 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:
/**
* Second-phase constructor.
+ *
+ * @param[in] size The size of the set surface
*/
- void Initialize( Integration::RenderSurface& surface );
+ void Initialize( Size size );
// Undefined
Scene(const Scene&) = delete;
Scene& operator=(const Scene& rhs) = delete;
private:
- Integration::RenderSurface* mSurface;
+ Internal::SceneGraph::Scene* mSceneObject;
Size mSize;
// The list of render-tasks
IntrusivePtr<RenderTaskList> mRenderTaskList;
- // The frame buffer
- FrameBufferPtr mFrameBuffer;
-
bool mDepthTreeDirty:1; ///< True if the depth tree needs recalculating
EventProcessor mEventProcessor;
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<Dali::Internal::SceneGraph::DirtyRect> mItemsDirtyRects;
};
} // Internal