1 #ifndef __DALI_ECORE_X_RENDER_SURFACE_H__
2 #define __DALI_ECORE_X_RENDER_SURFACE_H__
5 * Copyright (c) 2014 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.
23 #include <dali/public-api/common/dali-common.h>
26 #include <render-surface.h>
27 #include <ecore-x-types.h>
28 #include <egl-interface.h>
33 class TriggerEventInterface;
39 * Ecore X11 implementation of render surface.
40 * @todo change namespace to ECore_X11 as the class
41 * is no longer pure X11.
43 class DALI_IMPORT_API EcoreXRenderSurface : public Dali::RenderSurface
47 * Uses an X11 surface to render to.
48 * @param [in] positionSize the position and size of the surface
49 * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int).
50 * @param [in] name optional name of surface passed in
51 * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
53 EcoreXRenderSurface(Dali::PositionSize positionSize,
55 const std::string& name,
56 bool isTransparent = false);
60 * Will delete the display, if it has ownership.
61 * Will delete the window/pixmap if it has owner ship
63 virtual ~EcoreXRenderSurface();
67 * Second stage construction
68 * Creates the surface (window, pixmap or native buffer)
70 void Init( Any surface );
75 * @brief Sets the render notification trigger to call when render thread is completed a frame
77 * @param renderNotification to use
79 void SetRenderNotification(TriggerEventInterface* renderNotification);
82 * @brief Get window handle
84 * @return the Ecore X window handle
86 Ecore_X_Window GetXWindow();
89 * Get the surface as an Ecore_X_drawable
91 virtual Ecore_X_Drawable GetDrawable();
94 * @brief Get the render surface the adaptor is using to render to.
96 * @return reference to current render surface (eg, pixmap / window)
98 virtual Any GetSurface() = 0;
100 public: // from Dali::RenderSurface
103 * @copydoc Dali::RenderSurface::GetPositionSize()
105 virtual PositionSize GetPositionSize() const;
108 * @copydoc Dali::RenderSurface::InitializeEgl()
110 virtual void InitializeEgl( EglInterface& egl ) = 0;
113 * @copydoc Dali::RenderSurface::CreateEglSurface()
115 virtual void CreateEglSurface( EglInterface& egl ) = 0;
118 * @copydoc Dali::RenderSurface::DestroyEglSurface()
120 virtual void DestroyEglSurface( EglInterface& egl ) = 0;
123 * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
125 virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0;
128 * @copydoc Dali::RenderSurface::MoveResize()
130 virtual void MoveResize( Dali::PositionSize positionSize);
133 * @copydoc Dali::RenderSurface::SetViewMode()
135 void SetViewMode( ViewMode viewMode );
138 * @copydoc Dali::RenderSurface::StartRender()
140 virtual void StartRender() = 0;
143 * @copydoc Dali::RenderSurface::PreRender()
145 virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) = 0;
148 * @copydoc Dali::RenderSurface::PostRender()
150 virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) = 0;
153 * @copydoc Dali::RenderSurface::ReleaseLock()
155 virtual void ReleaseLock() = 0;
160 * Get the surface id if the surface parameter is not empty
161 * @param surface Any containing a surface id, or can be empty
162 * @return surface id, or zero if surface is empty
164 unsigned int GetSurfaceId( Any surface ) const;
171 virtual void CreateXRenderable() = 0;
174 * Use an existing render surface
175 * @param surfaceId the id of the surface
177 virtual void UseExistingRenderable( unsigned int surfaceId ) = 0;
181 PositionSize mPosition; ///< Position
182 std::string mTitle; ///< Title of window which shows from "xinfo -topvwins" command
183 TriggerEventInterface* mRenderNotification; ///< Render notification trigger
184 ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit)
185 bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it)
192 #endif // __DALI_ECORE_X_RENDER_SURFACE_H__