X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fintegration-api%2Fadaptor-framework%2Frender-surface-interface.h;h=45250b16a19113fda8f3ae74a3b06e7efd029ecc;hb=aa19ec5a3944989bb2eed21eb6c316775cafd38a;hp=01260b2977de3d151c4c7b72d36f1b9269090761;hpb=f26bba2b8004bd88a3fb7c0d9f0fe265cb350fab;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/integration-api/adaptor-framework/render-surface-interface.h b/dali/integration-api/adaptor-framework/render-surface-interface.h old mode 100755 new mode 100644 index 01260b2..45250b1 --- a/dali/integration-api/adaptor-framework/render-surface-interface.h +++ b/dali/integration-api/adaptor-framework/render-surface-interface.h @@ -2,7 +2,7 @@ #define DALI_RENDER_SURFACE_INTERFACE_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. @@ -19,13 +19,17 @@ */ // EXTERNAL INCLUDES -#include #include +#include +#include +#include +#include #include +#include +#include namespace Dali { - class DisplayConnection; class ThreadSynchronizationInterface; @@ -35,8 +39,14 @@ namespace Adaptor { class AdaptorInternalServices; class GraphicsInterface; -} -} +} // namespace Adaptor +} // namespace Internal + +/** + * @brief The position and size of the render surface. + */ +using PositionSize = Dali::Rect; +using SurfaceSize = Uint16Pair; /** * @brief Interface for a render surface onto which Dali draws. @@ -51,27 +61,38 @@ class GraphicsInterface; * implementation of RenderSurface for the given platform */ -class RenderSurfaceInterface : public Dali::Integration::RenderSurface +class RenderSurfaceInterface { public: + enum Type + { + WINDOW_RENDER_SURFACE, + PIXMAP_RENDER_SURFACE, + NATIVE_RENDER_SURFACE + }; /** * @brief Constructor * Inlined as this is a pure abstract interface */ RenderSurfaceInterface() - : mAdaptor( nullptr ), - mGraphics( nullptr ), - mDisplayConnection( nullptr ), - mDepthBufferRequired( Integration::DepthBufferAvailable::FALSE ), - mStencilBufferRequired( Integration::StencilBufferAvailable::FALSE ) - {} + : mAdaptor(nullptr), + mGraphics(nullptr), + mDisplayConnection(nullptr), + mScene(), + mFullSwapNextFrame(true), + mDepthBufferRequired(Integration::DepthBufferAvailable::FALSE), + mStencilBufferRequired(Integration::StencilBufferAvailable::FALSE) + { + } /** * @brief Virtual Destructor. * Inlined as this is a pure abstract interface */ - virtual ~RenderSurfaceInterface() {} + virtual ~RenderSurfaceInterface() + { + } /** * @brief Return the size and position of the surface. @@ -84,7 +105,7 @@ public: * @param[out] dpiHorizontal set to the horizontal dpi * @param[out] dpiVertical set to the vertical dpi */ - virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0; + virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0; /** * @brief Return the orientation of the surface. @@ -117,7 +138,7 @@ public: * @brief Resizes the underlying surface. * @param[in] The dimensions of the new position */ - virtual void MoveResize( Dali::PositionSize positionSize ) = 0; + virtual void MoveResize(Dali::PositionSize positionSize) = 0; /** * @brief Called when Render thread has started @@ -129,9 +150,10 @@ public: * If the operation fails, then Core::Render should not be called until there is * a surface to render onto. * @param[in] resizingSurface True if the surface is being resized + * @param[in] damagedRects List of damaged rects this render pass * @return True if the operation is successful, False if the operation failed */ - virtual bool PreRender( bool resizingSurface ) = 0; + virtual bool PreRender(bool resizingSurface, const std::vector>& damagedRects, Rect& clippingRect) = 0; /** * @brief Invoked by render thread after Core::Render @@ -139,7 +161,8 @@ public: * @param[in] replacingSurface True if the surface is being replaced. * @param[in] resizingSurface True if the surface is being resized. */ - virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface ) = 0; + virtual void PostRender(bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector>& damagedRects) = 0; + /** * @brief Invoked by render thread when the thread should be stop */ @@ -155,12 +178,12 @@ public: * * @param threadSynchronization The thread-synchronization implementation. */ - virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) = 0; + virtual void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) = 0; /** * @brief Gets the surface type */ - virtual Dali::Integration::RenderSurface::Type GetSurfaceType() = 0; + virtual Dali::RenderSurfaceInterface::Type GetSurfaceType() = 0; /** * @brief Makes the graphics context current @@ -179,59 +202,62 @@ public: */ virtual Integration::StencilBufferAvailable GetStencilBufferRequired() = 0; - /** - * @brief Sets currentframe damaged rects - * @param[in] Sets currentframe damaged rects - * @param[out] return merged rect - */ - virtual void SetDamagedRect( const Dali::DamagedRect& damagedRect, Dali::DamagedRect& mergedRectArray ) = 0; - - /** - * @brief Gets buffer age - */ - virtual int32_t GetBufferAge() = 0; - public: - - void SetAdaptor( Dali::Internal::Adaptor::AdaptorInternalServices& adaptor ) + void SetAdaptor(Dali::Internal::Adaptor::AdaptorInternalServices& adaptor) { mAdaptor = &adaptor; } - void SetGraphicsInterface( Dali::Internal::Adaptor::GraphicsInterface& graphics ) + void SetGraphicsInterface(Dali::Internal::Adaptor::GraphicsInterface& graphics) { mGraphics = &graphics; } - void SetDisplayConnection( Dali::DisplayConnection& displayConnection ) + void SetDisplayConnection(Dali::DisplayConnection& displayConnection) { mDisplayConnection = &displayConnection; } -private: + /** + * @brief Sets a Scene that is rendered on this surface. + * @param scene The Scene object + */ + void SetScene(Dali::Integration::Scene& scene) + { + mScene = scene; + } /** + * @brief Forces full surface swap next frame, resets current partial update state. + */ + void SetFullSwapNextFrame() + { + mFullSwapNextFrame = true; + } + +private: + /** * @brief Undefined copy constructor. RenderSurface cannot be copied */ - RenderSurfaceInterface( const RenderSurfaceInterface& rhs ); + RenderSurfaceInterface(const RenderSurfaceInterface& rhs); /** * @brief Undefined assignment operator. RenderSurface cannot be copied */ - RenderSurfaceInterface& operator=( const RenderSurfaceInterface& rhs ); + RenderSurfaceInterface& operator=(const RenderSurfaceInterface& rhs); protected: - Dali::Internal::Adaptor::AdaptorInternalServices* mAdaptor; - Dali::Internal::Adaptor::GraphicsInterface* mGraphics; - Dali::DisplayConnection* mDisplayConnection; + Dali::Internal::Adaptor::GraphicsInterface* mGraphics; + Dali::DisplayConnection* mDisplayConnection; + WeakHandle mScene; + bool mFullSwapNextFrame; ///< Whether the full surface swap is required private: + Integration::DepthBufferAvailable mDepthBufferRequired; ///< Whether the depth buffer is required + Integration::StencilBufferAvailable mStencilBufferRequired; ///< Whether the stencil buffer is required - Integration::DepthBufferAvailable mDepthBufferRequired; ///< Whether the depth buffer is required - Integration::StencilBufferAvailable mStencilBufferRequired; ///< Whether the stencil buffer is required - - Vector4 mBackgroundColor; ///< The background color of the surface + Vector4 mBackgroundColor; ///< The background color of the surface }; } // namespace Dali