use modern construct 'override' in the derive class.
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / frame-buffer-impl.h
index bf7f42f..1b59e74 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/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
 {
+using Mask = Dali::FrameBuffer::Attachment::Mask;
+
 namespace Internal
 {
 namespace Render
@@ -36,12 +39,14 @@ class FrameBuffer;
 }
 
 class FrameBuffer;
-typedef IntrusivePtr<FrameBuffer> FrameBufferPtr;
+using FrameBufferPtr = IntrusivePtr<FrameBuffer>;
 
 class FrameBuffer : public BaseObject
 {
 public:
 
+  using Mask = Dali::FrameBuffer::Attachment::Mask;
+
   /**
    * @brief Create a new FrameBuffer
    *
@@ -50,7 +55,12 @@ public:
    * @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, unsigned int attachments );
+  static FrameBufferPtr New( uint32_t width, uint32_t height, Mask attachments );
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  ~FrameBuffer() override;
 
   /**
    * @brief Get the FrameBuffer render object
@@ -62,12 +72,39 @@ 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::DevelFrameBuffer::AttachDepthTexture()
+   */
+  void AttachDepthTexture( TexturePtr texture, uint32_t mipmapLevel );
+
+  /**
+   * @copydoc Dali::DevelFrameBuffer::AttachDepthStencilTexture()
+   */
+  void AttachDepthStencilTexture( TexturePtr texture, uint32_t mipmapLevel );
 
   /**
    * @copydoc Dali::FrameBuffer::GetColorTexture()
    */
-  NewTexture* GetColorTexture();
+  Texture* GetColorTexture(uint8_t index) const;
+
+  /**
+   * @copydoc Dali::DevelFrameBuffer::GetDepthTexture()
+   */
+  Texture* GetDepthTexture() const;
+
+  /**
+   * @copydoc Dali::DevelFrameBuffer::GetDepthStencilTexture()
+   */
+  Texture* GetDepthStencilTexture() 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
 
@@ -77,7 +114,7 @@ private: // implementation
    * @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, unsigned int attachments );
+  FrameBuffer( uint32_t width, uint32_t height, Mask attachments );
 
   /**
    * Second stage initialization of the Texture
@@ -86,25 +123,24 @@ 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& );
+
+  FrameBuffer() = delete;
+  FrameBuffer( const FrameBuffer& ) = delete;
+  FrameBuffer& operator=( const FrameBuffer& ) = delete;
 
 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
 
-  NewTexturePtr mColor;
-  unsigned int mWidth;
-  unsigned int mHeight;
-  unsigned int mAttachments;                           ///< Bit-mask of type FrameBuffer::Attachment::Mask
-
+  TexturePtr mColor[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ];
+  TexturePtr mDepth;
+  TexturePtr mStencil;
+  uint32_t mWidth;
+  uint32_t mHeight;
+  Mask mAttachments;                           ///< Bit-mask of type FrameBuffer::Attachment::Mask
+  uint8_t mColorAttachmentCount;
 };
 
 } // namespace Internal