1 #ifndef __DALI_ECORE_WL_RENDER_SURFACE_H__
2 #define __DALI_ECORE_WL_RENDER_SURFACE_H__
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <Ecore_Wayland.h>
23 #include <dali/public-api/common/dali-common.h>
26 #include <dali/devel-api/adaptor-framework/render-surface.h>
27 #include <dali/integration-api/egl-interface.h>
32 class TriggerEventInterface;
38 * Ecore Wayland implementation of render surface.
39 * @todo change namespace to ECore_Wayland as the class
40 * is no longer pure Wayland.
42 class DALI_IMPORT_API EcoreWlRenderSurface : public Dali::RenderSurface
46 * Uses an Wayland surface to render to.
47 * @param [in] positionSize the position and size of the surface
48 * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int).
49 * @param [in] name optional name of surface passed in
50 * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
52 EcoreWlRenderSurface(Dali::PositionSize positionSize,
54 const std::string& name,
55 bool isTransparent = false);
59 * Will delete the display, if it has ownership.
60 * Will delete the window/pixmap if it has owner ship
62 virtual ~EcoreWlRenderSurface();
66 * Second stage construction
67 * Creates the surface (window, pixmap or native buffer)
69 void Init( Any surface );
74 * @brief Sets the render notification trigger to call when render thread is completed a frame
76 * @param renderNotification to use
78 void SetRenderNotification(TriggerEventInterface* renderNotification);
81 * @brief Get window handle
83 * @return the Ecore X window handle
85 virtual Ecore_Wl_Window* GetWlWindow();
88 * Get the surface as an Ecore_Wl_Window
90 virtual Ecore_Wl_Window* GetDrawable();
92 public: // from Dali::RenderSurface
95 * @copydoc Dali::RenderSurface::GetPositionSize()
97 virtual PositionSize GetPositionSize() const;
100 * @copydoc Dali::RenderSurface::InitializeEgl()
102 virtual void InitializeEgl( EglInterface& egl ) = 0;
105 * @copydoc Dali::RenderSurface::CreateEglSurface()
107 virtual void CreateEglSurface( EglInterface& egl ) = 0;
110 * @copydoc Dali::RenderSurface::DestroyEglSurface()
112 virtual void DestroyEglSurface( EglInterface& egl ) = 0;
115 * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
117 virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0;
120 * @copydoc Dali::RenderSurface::MoveResize()
122 virtual void MoveResize( Dali::PositionSize positionSize);
125 * @copydoc Dali::RenderSurface::SetViewMode()
127 void SetViewMode( ViewMode viewMode );
130 * @copydoc Dali::RenderSurface::StartRender()
132 virtual void StartRender() = 0;
135 * @copydoc Dali::RenderSurface::PreRender()
137 virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) = 0;
140 * @copydoc Dali::RenderSurface::PostRender()
142 virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) = 0;
145 * @copydoc Dali::RenderSurface::ReleaseLock()
147 virtual void ReleaseLock() = 0;
150 * @copydoc Dali::RenderSurface::GetSurfaceType()
152 virtual RenderSurface::Type GetSurfaceType();
157 * Get the surface id if the surface parameter is not empty
158 * @param surface Any containing a surface id, or can be empty
159 * @return surface id, or zero if surface is empty
161 unsigned int GetSurfaceId( Any surface ) const;
168 virtual void CreateWlRenderable() = 0;
171 * Use an existing render surface
172 * @param surfaceId the id of the surface
174 virtual void UseExistingRenderable( unsigned int surfaceId ) = 0;
178 PositionSize mPositionSize; ///< Position
179 std::string mTitle; ///< Title of window which shows from "xinfo -topvwins" command
180 TriggerEventInterface* mRenderNotification; ///< Render notification trigger
181 ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit)
182 bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it)
189 #endif // __DALI_ECORE_WL_RENDER_SURFACE_H__