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 ) {}
74 class Adaptor: public BaseObject
77 static Dali::Adaptor& Get();
82 static Dali::RenderSurface& GetSurface();
83 static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
86 Dali::Adaptor& Adaptor::Get()
88 Dali::Adaptor* adaptor = new Dali::Adaptor;
92 Dali::RenderSurface& Adaptor::GetSurface()
94 Dali::RenderSurface *renderSurface = new Dali::TestRenderSurface;
95 return *renderSurface;
98 Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal()
100 Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType;
111 Adaptor& Adaptor::New( Window window )
113 return Internal::Adaptor::Adaptor::Get();
116 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
118 return Internal::Adaptor::Adaptor::Get();
121 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface )
123 return Internal::Adaptor::Adaptor::Get();
126 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration )
128 return Internal::Adaptor::Adaptor::Get();
135 void Adaptor::Start()
139 void Adaptor::Pause()
143 void Adaptor::Resume()
151 bool Adaptor::AddIdle( CallbackBase* callback )
156 void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
160 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
162 return Internal::Adaptor::Adaptor::AdaptorSignal();
165 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
167 return Internal::Adaptor::Adaptor::AdaptorSignal();
170 RenderSurface& Adaptor::GetSurface()
172 return Internal::Adaptor::Adaptor::GetSurface();
175 Any Adaptor::GetNativeWindowHandle()
181 void Adaptor::ReleaseSurfaceLock()
185 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
189 void Adaptor::SetUseHardwareVSync(bool useHardware)
193 Adaptor& Adaptor::Get()
195 return Internal::Adaptor::Adaptor::Get();
198 bool Adaptor::IsAvailable()
203 void Adaptor::NotifySceneCreated()
207 void Adaptor::NotifyLanguageChanged()
211 void Adaptor::SetMinimumPinchDistance(float distance)
215 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
219 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
223 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
227 void Adaptor::SceneCreated()
231 void Adaptor::SetViewMode( ViewMode mode )
235 void Adaptor::SetStereoBase( float stereoBase )