Support multiple window rendering
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-surface-frame-buffer.h
1 #ifndef DALI_INTERNAL_RENDER_SURFACE_FRAME_BUFFER_H
2 #define DALI_INTERNAL_RENDER_SURFACE_FRAME_BUFFER_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 // INTERNAL INCLUDES
21 #include <dali/internal/render/renderers/render-frame-buffer.h>
22 #include <dali/integration-api/render-surface.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 class Context;
31
32 namespace Render
33 {
34
35 class SurfaceFrameBuffer : public FrameBuffer
36 {
37 public:
38
39   /**
40    * Constructor
41    * @param[in] surface The render surface
42    */
43   SurfaceFrameBuffer( Integration::RenderSurface* surface );
44
45   /**
46    * Destructor
47    */
48   virtual ~SurfaceFrameBuffer();
49
50   /**
51    * @copydoc Dali::Internal::Renderer::FrameBuffer::Initialize()
52    */
53   void Initialize( Context& context ) override;
54
55   /**
56    * @copydoc Dali::Internal::Renderer::FrameBuffer::Destroy()
57    */
58   void Destroy( Context& context ) override;
59
60   /**
61    * @copydoc Dali::Internal::Renderer::FrameBuffer::GlContextDestroyed()
62    */
63   void GlContextDestroyed() override;
64
65   /**
66    * @copydoc Dali::Internal::Renderer::FrameBuffer::Bind()
67    */
68   void Bind( Context& context ) override;
69
70   /**
71    * @copydoc Dali::Internal::Renderer::FrameBuffer::GetWidth()
72    */
73   uint32_t GetWidth() const override;
74
75   /**
76    * @copydoc Dali::Internal::Renderer::FrameBuffer::GetHeight()
77    */
78   uint32_t GetHeight() const override;
79
80   /**
81    * @copydoc Dali::Internal::Renderer::FrameBuffer::IsSurfaceBacked()
82    */
83   bool IsSurfaceBacked() override { return true; };
84
85 public:
86
87   /**
88    * Called after this frame buffer is rendered in the render manager
89    */
90   void PostRender();
91
92   /**
93    * Gets the context holding the GL state of rendering for the surface
94    * @return the context
95    */
96   Context* GetContext();
97
98   /**
99    * @brief Gets whether the depth buffer is required
100    * @return TRUE if the depth buffer is required
101    */
102   Integration::DepthBufferAvailable GetDepthBufferRequired();
103
104   /**
105    * @brief Gets whether the stencil buffer is required
106    * @return TRUE if the stencil buffer is required
107    */
108   Integration::StencilBufferAvailable GetStencilBufferRequired();
109
110   /**
111    * @brief Gets the background color of the surface.
112    * @return The background color
113    */
114   Vector4 GetBackgroundColor();
115
116 private:
117
118   Integration::RenderSurface* mSurface;   ///< The render surface
119   Context*                    mContext;   ///< The context holding the GL state of rendering for the surface backed frame buffer
120 };
121
122
123 } // namespace Render
124
125 } // namespace Internal
126
127 } // namespace Dali
128
129
130 #endif // DALI_INTERNAL_RENDER_SURFACE_FRAME_BUFFER_H