[dali_2.3.23] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / pixmap-render-surface.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_PIXMAP_RENDER_SURFACE_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_PIXMAP_RENDER_SURFACE_H
3
4 /*
5  * Copyright (c) 2021 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
21 // INTERNAL INCLUDES
22 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
23 #include <dali/internal/graphics/common/graphics-interface.h>
24
25 namespace Dali
26 {
27 class TriggerEventInterface;
28
29 namespace Internal
30 {
31 namespace Adaptor
32 {
33 /**
34  * Pixmap interface of render surface.
35  */
36 class PixmapRenderSurface : public Dali::RenderSurfaceInterface
37 {
38 public:
39   /**
40    * @brief Default constructor
41    */
42   PixmapRenderSurface() = default;
43
44   /**
45    * @brief Destructor
46    */
47   virtual ~PixmapRenderSurface() = default;
48
49 public: // API
50   /**
51    * @brief Get the render surface the adaptor is using to render to.
52    * @return reference to current render surface
53    */
54   virtual Any GetSurface() = 0;
55
56   /**
57    * @brief Sets the render notification trigger to call when render thread is completed a frame
58    * @param renderNotification to use
59    */
60   virtual void SetRenderNotification(TriggerEventInterface* renderNotification) = 0;
61
62   /**
63    * @copydoc Dali::RenderSurfaceInterface::GetDepthBufferRequired()
64    */
65   Integration::DepthBufferAvailable GetDepthBufferRequired() override
66   {
67     return mGraphics ? mGraphics->GetDepthBufferRequired() : Integration::DepthBufferAvailable::FALSE;
68   }
69
70   /**
71    * @copydoc Dali::RenderSurfaceInterface::GetStencilBufferRequired()
72    */
73   Integration::StencilBufferAvailable GetStencilBufferRequired() override
74   {
75     return mGraphics ? mGraphics->GetStencilBufferRequired() : Integration::StencilBufferAvailable::FALSE;
76   }
77
78 private:
79   /**
80    * Second stage construction
81    */
82   virtual void Initialize(Any surface) = 0;
83
84   /**
85    * @brief Create a renderable
86    */
87   virtual void CreateRenderable() = 0;
88
89   /**
90    * @brief Use an existing render surface
91    * @param surfaceId the id of the surface
92    */
93   virtual void UseExistingRenderable(unsigned int surfaceId) = 0;
94
95 protected:
96   // Undefined
97   PixmapRenderSurface(const PixmapRenderSurface&) = delete;
98
99   // Undefined
100   PixmapRenderSurface& operator=(const PixmapRenderSurface& rhs) = delete;
101 };
102
103 } // namespace Adaptor
104
105 } // namespace Internal
106
107 } // namespace Dali
108
109 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_PIXMAP_RENDER_SURFACE_H