[dali_1.4.55] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / frame-buffer-impl.h
index 9389193..e30c285 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_FRAME_BUFFER_H
 
 /*
- * Copyright (c) 2018 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/common/intrusive-ptr.h> // Dali::IntrusivePtr
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/rendering/frame-buffer.h>
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
 #include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/event/rendering/texture-impl.h>
 
 namespace Dali
 {
+
+namespace Integration
+{
+class RenderSurface;
+}
+
 namespace Internal
 {
 namespace Render
@@ -55,6 +62,20 @@ public:
   static FrameBufferPtr New( uint32_t width, uint32_t height, Mask attachments );
 
   /**
+   * @brief Create a new FrameBuffer
+   *
+   * @param[in] renderSurface   The render surface
+   * @param[in] attachments     The attachments comprising the format of the FrameBuffer (bit-mask)
+   * @return A smart-pointer to the newly allocated Texture.
+   */
+  static FrameBufferPtr New( Dali::Integration::RenderSurface& renderSurface, Mask attachments );
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~FrameBuffer();
+
+  /**
    * @brief Get the FrameBuffer render object
    *
    * @return the FrameBuffer render object
@@ -69,7 +90,24 @@ public:
   /**
    * @copydoc Dali::FrameBuffer::GetColorTexture()
    */
-  Texture* GetColorTexture();
+  Texture* GetColorTexture(uint8_t index) const;
+
+  /**
+   * @brief Sets the frame buffer size.
+   * @param[in] width The width size
+   * @param[in] height The height size
+   */
+  void SetSize( uint32_t width, uint32_t height );
+
+  /**
+   * @brief Mark the render surface as invalid
+   *
+   * The render surface is maked as invalid when it is deleted.
+   *
+   * @note Only for FrameBuffer backed by a render surface.
+   * @return True if the FrameBuffer is backed by a render surface
+   */
+  void MarkSurfaceAsInvalid();
 
 private: // implementation
 
@@ -84,15 +122,10 @@ private: // implementation
   /**
    * Second stage initialization of the Texture
    */
-  void Initialize();
+  void Initialize( Integration::RenderSurface* renderSurface = nullptr );
 
 protected:
 
-  /**
-   * A reference counted object may only be deleted by calling Unreference()
-   */
-  virtual ~FrameBuffer();
-
 private: // unimplemented methods
 
   FrameBuffer() = delete;
@@ -104,10 +137,13 @@ private: // data
   Internal::EventThreadServices& mEventThreadServices; ///< Used to send messages to the render thread via update thread
   Internal::Render::FrameBuffer* mRenderObject;        ///< The Render::Texture associated to this texture
 
-  TexturePtr mColor;
+  TexturePtr mColor[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ];
   uint32_t mWidth;
   uint32_t mHeight;
   Mask mAttachments;                           ///< Bit-mask of type FrameBuffer::Attachment::Mask
+  uint8_t mColorAttachmentCount;
+
+  bool mIsSurfaceBacked:1;
 
 };