Remove RenderSurface from Core
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / frame-buffer-impl.h
index af03c69..9913b4d 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_FRAME_BUFFER_H
 
 /*
- * Copyright (c) 2016 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/dali-common.h> // DALI_ASSERT_ALWAYS
 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
 #include <dali/public-api/object/base-object.h>
-#include <dali/devel-api/rendering/frame-buffer.h>
-#include <dali/internal/event/rendering/texture-impl.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
 {
+using Mask = Dali::FrameBuffer::Attachment::Mask;
+
 namespace Internal
 {
 namespace Render
@@ -42,17 +45,22 @@ class FrameBuffer : public BaseObject
 {
 public:
 
-  typedef Dali::FrameBuffer::Format Format;
+  using Mask = Dali::FrameBuffer::Attachment::Mask;
 
   /**
    * @brief Create a new FrameBuffer
    *
-   * @param[in] width The width of the FrameBuffer
-   * @param[in] height The height of the FrameBuffer
-   * @param[in] format The format of the FrameBuffer
+   * @param[in] width       The width of the FrameBuffer
+   * @param[in] height      The height of the FrameBuffer
+   * @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( unsigned int width, unsigned int height, Format format );
+  static FrameBufferPtr New( uint32_t width, uint32_t height, Mask attachments );
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~FrameBuffer();
 
   /**
    * @brief Get the FrameBuffer render object
@@ -64,22 +72,29 @@ public:
   /**
    * @copydoc Dali::FrameBuffer::AttachColorTexture()
    */
-  void AttachColorTexture( NewTexturePtr texture, unsigned int mipmapLevel, unsigned int layer );
+  void AttachColorTexture( TexturePtr texture, uint32_t mipmapLevel, uint32_t layer );
 
   /**
    * @copydoc Dali::FrameBuffer::GetColorTexture()
    */
-  NewTexture* 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 );
 
 private: // implementation
 
   /**
    * Constructor
-   * @param[in] width The width of the FrameBuffer
-   * @param[in] height The height of the FrameBuffer
-   * @param[in] format The format of the FrameBuffer
+   * @param[in] width       The width of the FrameBuffer
+   * @param[in] height      The height of the FrameBuffer
+   * @param[in] attachments The attachments comprising the format of the FrameBuffer (bit-mask)
    */
-  FrameBuffer( unsigned int width, unsigned int height, Format format );
+  FrameBuffer( uint32_t width, uint32_t height, Mask attachments );
 
   /**
    * Second stage initialization of the Texture
@@ -88,25 +103,22 @@ private: // implementation
 
 protected:
 
-  /**
-   * A reference counted object may only be deleted by calling Unreference()
-   */
-  virtual ~FrameBuffer();
-
 private: // unimplemented methods
-  FrameBuffer( const FrameBuffer& );
-  FrameBuffer& operator=( const FrameBuffer& );
 
-private: // data
+  FrameBuffer() = delete;
+  FrameBuffer( const FrameBuffer& ) = delete;
+  FrameBuffer& operator=( const FrameBuffer& ) = delete;
 
-  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
+private: // data
 
-  NewTexturePtr mColor;
-  unsigned int mWidth;
-  unsigned int mHeight;
-  Format mFormat;
+  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[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ];
+  uint32_t mWidth;
+  uint32_t mHeight;
+  Mask mAttachments;                           ///< Bit-mask of type FrameBuffer::Attachment::Mask
+  uint8_t mColorAttachmentCount;
 };
 
 } // namespace Internal