1 #ifndef __DALI_INTERNAL_RENDER_SURFACE_H__
2 #define __DALI_INTERNAL_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.
22 #include <render-surface.h>
23 #include <dali/public-api/common/dali-common.h>
24 #include <dali/public-api/common/view-mode.h>
25 #include <base/interfaces/egl-interface.h>
35 } // namespace Integration
46 * This is the internal RenderSurface API
48 class RenderSurface : public Dali::RenderSurface
60 virtual ~RenderSurface();
65 * Initialize EGL, RenderSurface should create egl display and initialize
66 * @param egl implementation to use for the creation
68 virtual void InitializeEgl( EglInterface& egl ) = 0;
72 * @param egl implementation to use for the creation
74 virtual void CreateEglSurface( EglInterface& egl ) = 0;
77 * Destroys EGL Surface
78 * @param egl implementation to use for the destruction
80 virtual void DestroyEglSurface( EglInterface& egl ) = 0;
83 * Replace the EGL Surface
84 * @param egl implementation to use for the creation
85 * @return true if context was lost
87 virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0;
90 * Resizes the underlying surface.
91 * Only available for x window
93 virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
97 * @param dpiHorizontal set to the horizontal dpi
98 * @param dpiVertical set to the vertical dpi
100 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) const = 0;
103 * Call to map the surface (only works if surface is a window)
105 virtual void Map() = 0;
108 * Transfers the ownership of a display
109 * @param newSurface to transfer
111 virtual void TransferDisplayOwner( Internal::Adaptor::RenderSurface& newSurface ) = 0;
114 * Consumes any possible events on the queue so that there is no leaking between frames
116 virtual void ConsumeEvents() = 0;
119 * Set the stereoscopic 3D view mode
120 * @param[in] viewMode The new view mode
122 virtual void SetViewMode( ViewMode viewMode ) = 0;
125 * Called when Render thread has started
127 virtual void StartRender() = 0;
130 * Invoked by render thread before Core::Render
131 * If the operation fails, then Core::Render should not be called until there is
132 * a surface to render onto.
133 * @param[in] egl The Egl interface
134 * @param[in] glAbstraction OpenGLES abstraction interface
135 * @return True if the operation is successful, False if the operation failed
137 virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) = 0;
140 * Invoked by render thread after Core::Render
141 * @param[in] egl The Egl interface
142 * @param[in] glAbstraction OpenGLES abstraction interface
143 * @param[in] deltaTime Time (in microseconds) since PostRender was last called.
144 * @param[in] replacingSurface True if the surface is being replaced.
146 virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int deltaTime, bool replacingSurface ) = 0;
149 * Invoked by render thread when the thread should be stop
151 virtual void StopRender() = 0;
154 * Invoked by Event Thread when the compositor lock should be released and rendering should resume.
156 virtual void ReleaseLock() = 0;
159 } // namespace Adaptor
161 } // namespace internal
165 #endif // __DALI_INTERNAL_RENDER_SURFACE_H__