Revert "[Tizen] Fix build error for pepper-dali"
[platform/core/uifw/dali-adaptor.git] / dali / integration-api / wayland / native-render-surface.h
1 #ifndef __DALI_NATIVE_RENDER_SURFACE_H__
2 #define __DALI_NATIVE_RENDER_SURFACE_H__
3
4 /*
5  * Copyright (c) 2014 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 // EXTERNAL INCLUDES
22 #include <tbm_surface.h>
23 #include <dali/public-api/common/dali-common.h>
24
25 // INTERNAL INCLUDES
26 #include <dali/devel-api/adaptor-framework/render-surface.h>
27 #ifdef DALI_ADAPTOR_COMPILATION
28 #include <dali/integration-api/egl-interface.h>
29 #else
30 #include <dali/integration-api/adaptors/egl-interface.h>
31 #endif
32
33 namespace Dali
34 {
35
36 class TriggerEventInterface;
37
38 /**
39  * Ecore X11 implementation of render surface.
40  */
41 class DALI_IMPORT_API NativeRenderSurface : public Dali::RenderSurface
42 {
43 public:
44
45   /**
46     * Uses an Wayland surface to render to.
47     * @param [in] positionSize the position and size of the surface
48     * @param [in] name optional name of surface passed in
49     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
50     */
51   NativeRenderSurface( Dali::PositionSize positionSize,
52                              const std::string& name,
53                              bool isTransparent = false );
54
55   /**
56    * @copydoc Dali::RenderSurface::~RenderSurface
57    */
58   virtual ~NativeRenderSurface();
59
60 public: // API
61
62   /**
63    * @brief Sets the render notification trigger to call when render thread is completed a frame
64    *
65    * @param renderNotification to use
66    */
67   void SetRenderNotification( TriggerEventInterface* renderNotification );
68
69   /**
70    * @brief Gets the tbm surface for offscreen rendering
71    */
72   virtual tbm_surface_h GetDrawable();
73
74   /**
75    * @brief Gets the surface
76    *
77    * @return TBM surface
78    */
79   virtual Any GetSurface();
80
81   /**
82    * @brief Waits until surface is replaced
83    * After tbm surface is acquired in PostRender, this function is finished.
84    */
85   void WaitUntilSurfaceReplaced();
86
87 public: // from Dali::RenderSurface
88
89   /**
90    * @copydoc Dali::RenderSurface::GetPositionSize()
91    */
92   virtual PositionSize GetPositionSize() const;
93
94   /**
95    * @copydoc Dali::RenderSurface::InitializeEgl()
96    */
97   virtual void InitializeEgl( EglInterface& egl );
98
99   /**
100    * @copydoc Dali::RenderSurface::CreateEglSurface()
101    */
102   virtual void CreateEglSurface( EglInterface& egl );
103
104   /**
105    * @copydoc Dali::RenderSurface::DestroyEglSurface()
106    */
107   virtual void DestroyEglSurface( EglInterface& egl );
108
109   /**
110    * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
111    */
112   virtual bool ReplaceEGLSurface( EglInterface& egl );
113
114   /**
115    * @copydoc Dali::RenderSurface::MoveResize()
116    */
117   virtual void MoveResize( Dali::PositionSize positionSize);
118
119   /**
120    * @copydoc Dali::RenderSurface::SetViewMode()
121    */
122   void SetViewMode( ViewMode viewMode );
123
124   /**
125    * @copydoc Dali::RenderSurface::StartRender()
126    */
127   virtual void StartRender();
128
129   /**
130    * @copydoc Dali::RenderSurface::PreRender()
131    */
132   virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface );
133
134   /**
135    * @copydoc Dali::RenderSurface::PostRender()
136    */
137   virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface );
138
139   /**
140    * @copydoc Dali::RenderSurface::StopRender()
141    */
142   virtual void StopRender();
143
144   /**
145    * @copydoc Dali::RenderSurface::SetThreadSynchronization
146    */
147   virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
148
149   /**
150    * @copydoc Dali::RenderSurface::GetSurfaceType()
151    */
152   virtual RenderSurface::Type GetSurfaceType();
153
154 private:
155
156   /**
157    * Release any locks.
158    */
159   void ReleaseLock();
160
161   /**
162    * Create tbm surface
163    */
164   virtual void CreateNativeRenderable();
165
166   /**
167    * Release tbm surface
168    */
169   void ReleaseDrawable();
170
171 private: // Data
172
173   struct Impl;
174
175   Impl* mImpl;
176
177 };
178
179 } // namespace Dali
180
181 #endif // __DALI_NATIVE_RENDER_SURFACE_H__