2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/integration-api/adaptors/adaptor.h>
21 #include <dali/public-api/object/base-object.h>
22 #include <dali/devel-api/adaptor-framework/render-surface.h>
28 class DisplayConnection;
29 class ThreadSynchronizationInterface;
36 } // namespace Integration
38 class TestRenderSurface : public RenderSurface
41 virtual PositionSize GetPositionSize() const { PositionSize size; return size; }
43 virtual void InitializeEgl( EglInterface& egl ) {}
45 virtual void CreateEglSurface( EglInterface& egl ) {}
47 virtual void DestroyEglSurface( EglInterface& egl ) {}
49 virtual bool ReplaceEGLSurface( EglInterface& egl ) { return false; }
51 virtual void MoveResize( Dali::PositionSize positionSize ) {}
53 virtual void SetViewMode( ViewMode viewMode ) {}
55 virtual void StartRender() {}
57 virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) { return false; }
59 virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) {}
61 virtual void StopRender() {}
63 virtual void ReleaseLock() {}
65 virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {}
67 virtual RenderSurface::Type GetSurfaceType() { return RenderSurface::ECORE_RENDER_SURFACE; }
75 class Adaptor: public BaseObject
78 static Dali::Adaptor& Get();
83 static Dali::RenderSurface& GetSurface();
84 static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
87 Dali::Adaptor& Adaptor::Get()
89 Dali::Adaptor* adaptor = new Dali::Adaptor;
93 Dali::RenderSurface& Adaptor::GetSurface()
95 Dali::RenderSurface *renderSurface = new Dali::TestRenderSurface;
96 return *renderSurface;
99 Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal()
101 Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType;
112 Adaptor& Adaptor::New( Window window )
114 return Internal::Adaptor::Adaptor::Get();
117 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
119 return Internal::Adaptor::Adaptor::Get();
122 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface )
124 return Internal::Adaptor::Adaptor::Get();
127 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration )
129 return Internal::Adaptor::Adaptor::Get();
136 void Adaptor::Start()
140 void Adaptor::Pause()
144 void Adaptor::Resume()
152 bool Adaptor::AddIdle( CallbackBase* callback )
157 void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
161 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
163 return Internal::Adaptor::Adaptor::AdaptorSignal();
166 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
168 return Internal::Adaptor::Adaptor::AdaptorSignal();
171 RenderSurface& Adaptor::GetSurface()
173 return Internal::Adaptor::Adaptor::GetSurface();
176 Any Adaptor::GetNativeWindowHandle()
182 void Adaptor::ReleaseSurfaceLock()
186 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
190 void Adaptor::SetUseHardwareVSync(bool useHardware)
194 Adaptor& Adaptor::Get()
196 return Internal::Adaptor::Adaptor::Get();
199 bool Adaptor::IsAvailable()
204 void Adaptor::NotifySceneCreated()
208 void Adaptor::NotifyLanguageChanged()
212 void Adaptor::SetMinimumPinchDistance(float distance)
216 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
220 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
224 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
228 void Adaptor::SceneCreated()
232 void Adaptor::SetViewMode( ViewMode mode )
236 void Adaptor::SetStereoBase( float stereoBase )