1 #ifndef __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__
2 #define __DALI_INTERNAL_ECORE_WL_WINDOW_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 <wayland-egl.h>
25 #include <ecore-wl-render-surface.h>
27 #include <integration-api/thread-synchronization-interface.h>
36 * @copydoc Dali::ECore::EcoreWlRenderSurface.
37 * Window specialization.
39 class WindowRenderSurface : public EcoreWlRenderSurface
44 * Uses an Wayland surface to render to.
45 * @param [in] positionSize the position and size of the surface
46 * @param [in] surface can be a Wayland-window or Wayland-pixmap (type must be unsigned int).
47 * @param [in] name optional name of surface passed in
48 * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
50 WindowRenderSurface( Dali::PositionSize positionSize,
52 const std::string& name,
53 bool isTransparent = false );
56 * @copydoc Dali::ECore::EcoreWlRenderSurface::~EcoreWlRenderSurface
58 virtual ~WindowRenderSurface();
63 * @copydoc Dali::RenderSurface::GetDrawable()
65 virtual Ecore_Wl_Window* GetDrawable();
73 * @copydoc Dali::ECore::EcoreWlRenderSurface::GetSurface()
75 virtual Any GetSurface();
78 * @copydoc Dali::ECore::EcoreWlRenderSurface::GetWlWindow()
80 virtual Ecore_Wl_Window* GetWlWindow();
83 * Request surface rotation
84 * @param[in] orientation A new orientation of the surface
85 * @param[in] width A new width of the surface
86 * @param[in] height A new height of the surface
88 void RequestRotation( Dali::Window::WindowOrientation orientation, int width, int height );
90 public: // from Dali::RenderSurface
93 * @copydoc Dali::RenderSurface::InitializeEgl()
95 virtual void InitializeEgl( EglInterface& egl );
98 * @copydoc Dali::RenderSurface::CreateEglSurface()
100 virtual void CreateEglSurface( EglInterface& egl );
103 * @copydoc Dali::RenderSurface::DestroyEglSurface()
105 virtual void DestroyEglSurface( EglInterface& egl );
108 * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
110 virtual bool ReplaceEGLSurface( EglInterface& egl );
113 * @copydoc Dali::RenderSurface::MoveResize()
115 virtual void MoveResize( Dali::PositionSize positionSize);
118 * @copydoc Dali::RenderSurface::SetViewMode()
120 void SetViewMode( ViewMode viewMode );
123 * @copydoc Dali::RenderSurface::StartRender()
125 virtual void StartRender();
128 * @copydoc Dali::RenderSurface::PreRender()
130 virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction );
133 * @copydoc Dali::RenderSurface::PostRender()
135 virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface );
138 * @copydoc Dali::RenderSurface::StopRender()
140 virtual void StopRender();
143 * @copydoc Dali::RenderSurface::SetThreadSynchronization
145 virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
148 * @copydoc Dali::RenderSurface::ReleaseLock()
150 virtual void ReleaseLock();
157 virtual void CreateWlRenderable();
160 * @copydoc Dali::Internal::Adaptor::ECore::EcoreWlRenderSurface::UseExistingRenderable
162 virtual void UseExistingRenderable( unsigned int surfaceId );
167 * Used as the callback for the rotation-trigger.
169 void ProcessRotationRequest();
173 typedef int (*EglWinGetCapabilitiesFunction)( wl_egl_window* eglWindow );
174 typedef int (*EglWinSetRotationFunction)( wl_egl_window* eglWindow, int rotation );
176 EglWinGetCapabilitiesFunction mEglWinGetCapabilitiesPtr;
177 EglWinSetRotationFunction mEglWinSetRotationPtr;
179 void* mLibHandle; ///< Handle for the loaded library
180 Ecore_Wl_Window* mWlWindow; ///< Wayland-Window
181 wl_egl_window* mEglWindow;
182 ThreadSynchronizationInterface* mThreadSynchronization;
183 TriggerEventInterface* mRotationTrigger;
184 bool mRotationSupported;
187 }; // class WindowRenderSurface
193 #endif // __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__