2 * Copyright (c) 2017 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 "adaptor-impl.h"
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/common/stage.h>
24 #include <dali/public-api/actors/layer.h>
25 #include <dali/devel-api/actors/actor-devel.h>
26 #include <dali/integration-api/debug.h>
27 #include <dali/integration-api/core.h>
28 #include <dali/integration-api/context-notifier.h>
29 #include <dali/integration-api/profiling.h>
30 #include <dali/integration-api/input-options.h>
31 #include <dali/integration-api/events/touch-event-integ.h>
34 #include <base/thread-controller.h>
35 #include <base/performance-logging/performance-interface-factory.h>
36 #include <base/lifecycle-observer.h>
38 #include <dali/devel-api/text-abstraction/font-client.h>
40 #include <callback-manager.h>
41 #include <render-surface.h>
42 #include <tts-player-impl.h>
43 #include <accessibility-adaptor-impl.h>
44 #include <events/gesture-manager.h>
45 #include <events/event-handler.h>
46 #include <gl/gl-proxy-implementation.h>
47 #include <gl/gl-implementation.h>
48 #include <gl/egl-sync-implementation.h>
49 #include <gl/egl-image-extensions.h>
50 #include <gl/egl-factory.h>
51 #include <imf-manager-impl.h>
52 #include <clipboard-impl.h>
53 #include <vsync-monitor.h>
54 #include <object-profiler.h>
55 #include <base/display-connection.h>
56 #include <window-impl.h>
58 #include <tizen-logging.h>
59 #include <image-loading.h>
61 #include <locale-utils.h>
63 using Dali::TextAbstraction::FontClient;
76 thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
77 } // unnamed namespace
79 Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
81 Dali::Adaptor* adaptor = new Dali::Adaptor;
82 Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions );
83 adaptor->mImpl = impl;
85 impl->Initialize(configuration);
90 Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
92 Any winId = window.GetNativeHandle();
94 Window& windowImpl = Dali::GetImplementation(window);
95 Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
96 windowImpl.SetAdaptor(*adaptor);
100 void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
102 // all threads here (event, update, and render) will send their logs to TIZEN Platform's LogMessage handler.
103 Dali::Integration::Log::LogFunction logFunction( Dali::TizenPlatform::LogMessage );
104 mEnvironmentOptions->SetLogFunction( logFunction );
105 mEnvironmentOptions->InstallLogFunction(); // install logging for main thread
107 mPlatformAbstraction = new TizenPlatform::TizenPlatformAbstraction;
110 GetDataStoragePath( path );
111 mPlatformAbstraction->SetDataStoragePath( path );
113 ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
114 if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
116 dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
118 // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
119 // files automatically.
121 if( mEnvironmentOptions->PerformanceServerRequired() )
123 mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, *mEnvironmentOptions );
126 mCallbackManager = CallbackManager::New();
128 PositionSize size = mSurface->GetPositionSize();
130 mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
132 if( mEnvironmentOptions->GetGlesCallTime() > 0 )
134 mGLES = new GlProxyImplementation( *mEnvironmentOptions );
138 mGLES = new GlImplementation();
141 const Integration::DepthBufferAvailable depthBufferAvailable = static_cast< Integration::DepthBufferAvailable >( mEnvironmentOptions->DepthBufferRequired() );
142 const Integration::StencilBufferAvailable stencilBufferAvailable = static_cast< Integration::StencilBufferAvailable >( mEnvironmentOptions->StencilBufferRequired() );
144 mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel(), depthBufferAvailable, stencilBufferAvailable );
146 EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
148 mCore = Integration::Core::New( *this,
149 *mPlatformAbstraction,
153 dataRetentionPolicy ,
154 ( 0u != mEnvironmentOptions->GetRenderToFboInterval() ) ? Integration::RenderToFrameBuffer::TRUE : Integration::RenderToFrameBuffer::FALSE,
155 depthBufferAvailable,
156 stencilBufferAvailable );
158 const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
159 if( 0u < timeInterval )
161 mObjectProfiler = new ObjectProfiler( timeInterval );
164 mNotificationTrigger = mTriggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
166 mVSyncMonitor = new VSyncMonitor;
168 mThreadController = new ThreadController( *this, *mEnvironmentOptions );
170 // Should be called after Core creation
171 if( mEnvironmentOptions->GetPanGestureLoggingLevel() )
173 Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
175 if( mEnvironmentOptions->GetPanGesturePredictionMode() >= 0 )
177 Integration::SetPanGesturePredictionMode(mEnvironmentOptions->GetPanGesturePredictionMode());
179 if( mEnvironmentOptions->GetPanGesturePredictionAmount() >= 0 )
181 Integration::SetPanGesturePredictionAmount(mEnvironmentOptions->GetPanGesturePredictionAmount());
183 if( mEnvironmentOptions->GetPanGestureMaximumPredictionAmount() >= 0 )
185 Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions->GetPanGestureMaximumPredictionAmount());
187 if( mEnvironmentOptions->GetPanGestureMinimumPredictionAmount() >= 0 )
189 Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions->GetPanGestureMinimumPredictionAmount());
191 if( mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment() >= 0 )
193 Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment());
195 if( mEnvironmentOptions->GetPanGestureSmoothingMode() >= 0 )
197 Integration::SetPanGestureSmoothingMode(mEnvironmentOptions->GetPanGestureSmoothingMode());
199 if( mEnvironmentOptions->GetPanGestureSmoothingAmount() >= 0.0f )
201 Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
203 if( mEnvironmentOptions->GetPanGestureUseActualTimes() >= 0 )
205 Integration::SetPanGestureUseActualTimes( mEnvironmentOptions->GetPanGestureUseActualTimes() == 0 ? true : false );
207 if( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() >= 0 )
209 Integration::SetPanGestureInterpolationTimeRange( mEnvironmentOptions->GetPanGestureInterpolationTimeRange() );
211 if( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() >= 0 )
213 Integration::SetPanGestureScalarOnlyPredictionEnabled( mEnvironmentOptions->GetPanGestureScalarOnlyPredictionEnabled() == 0 ? true : false );
215 if( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() >= 0 )
217 Integration::SetPanGestureTwoPointPredictionEnabled( mEnvironmentOptions->GetPanGestureTwoPointPredictionEnabled() == 0 ? true : false );
219 if( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() >= 0 )
221 Integration::SetPanGestureTwoPointInterpolatePastTime( mEnvironmentOptions->GetPanGestureTwoPointInterpolatePastTime() );
223 if( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() >= 0.0f )
225 Integration::SetPanGestureTwoPointVelocityBias( mEnvironmentOptions->GetPanGestureTwoPointVelocityBias() );
227 if( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() >= 0.0f )
229 Integration::SetPanGestureTwoPointAccelerationBias( mEnvironmentOptions->GetPanGestureTwoPointAccelerationBias() );
231 if( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() >= 0 )
233 Integration::SetPanGestureMultitapSmoothingRange( mEnvironmentOptions->GetPanGestureMultitapSmoothingRange() );
236 // Set max texture size
237 if( mEnvironmentOptions->GetMaxTextureSize() > 0 )
239 Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
242 SetupSystemInformation();
247 // Ensure stop status
250 // set to NULL first as we do not want any access to Adaptor as it is being destroyed.
251 gThreadLocalAdaptor = NULL;
253 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
255 (*iter)->OnDestroy();
258 delete mThreadController; // this will shutdown render thread, which will call Core::ContextDestroyed before exit
259 delete mVSyncMonitor;
260 delete mEventHandler;
261 delete mObjectProfiler;
266 delete mGestureManager;
267 delete mPlatformAbstraction;
268 delete mCallbackManager;
269 delete mPerformanceInterface;
271 // uninstall it on this thread (main actor thread)
272 Dali::Integration::Log::UninstallLogFunction();
274 // Delete environment options if we own it
275 if( mEnvironmentOptionsOwned )
277 delete mEnvironmentOptions;
281 void Adaptor::Start()
283 // it doesn't support restart after stop at this moment
284 // to support restarting, need more testing
285 if( READY != mState )
290 // Start the callback manager
291 mCallbackManager->Start();
293 // create event handler
294 mEventHandler = new EventHandler( mSurface, *this, *mGestureManager, *this, mDragAndDropDetector );
296 if( mDeferredRotationObserver != NULL )
298 mEventHandler->SetRotationObserver(mDeferredRotationObserver);
299 mDeferredRotationObserver = NULL;
302 unsigned int dpiHor, dpiVer;
304 Dali::DisplayConnection::GetDpi(dpiHor, dpiVer);
306 // tell core about the DPI value
307 mCore->SetDpi(dpiHor, dpiVer);
309 // set the DPI value for font rendering
310 FontClient fontClient = FontClient::Get();
311 fontClient.SetDpi( dpiHor, dpiVer );
313 // Tell the core the size of the surface just before we start the render-thread
314 PositionSize size = mSurface->GetPositionSize();
315 mCore->SurfaceResized( size.width, size.height );
317 // Initialize the thread controller
318 mThreadController->Initialize();
320 ProcessCoreEvents(); // Ensure any startup messages are processed.
322 for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
328 // Dali::Internal::Adaptor::Adaptor::Pause
329 void Adaptor::Pause()
331 // Only pause the adaptor if we're actually running.
332 if( RUNNING == mState )
334 // Inform observers that we are about to be paused.
335 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
340 // Reset the event handler when adaptor paused
343 mEventHandler->Pause();
346 mThreadController->Pause();
351 // Dali::Internal::Adaptor::Adaptor::Resume
352 void Adaptor::Resume()
354 // Only resume the adaptor if we are in the suspended state.
355 if( PAUSED == mState )
359 // Reset the event handler when adaptor resumed
362 mEventHandler->Resume();
365 // Inform observers that we have resumed.
366 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
371 // trigger processing of events queued up while paused
372 mCore->ProcessEvents();
374 // Do at end to ensure our first update/render after resumption includes the processed messages as well
375 mThreadController->Resume();
381 if( RUNNING == mState ||
383 PAUSED_WHILE_HIDDEN == mState )
385 for( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter )
390 mThreadController->Stop();
392 // Delete the TTS player
393 for(int i =0; i < Dali::TtsPlayer::MODE_NUM; i++)
397 mTtsPlayers[i].Reset();
401 delete mEventHandler;
402 mEventHandler = NULL;
404 delete mNotificationTrigger;
405 mNotificationTrigger = NULL;
407 mCallbackManager->Stop();
413 void Adaptor::ContextLost()
415 mCore->GetContextNotifier()->NotifyContextLost(); // Inform stage
418 void Adaptor::ContextRegained()
420 // Inform core, so that texture resources can be reloaded
421 mCore->RecoverFromContextLoss();
423 mCore->GetContextNotifier()->NotifyContextRegained(); // Inform stage
426 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
428 mEventHandler->FeedTouchPoint( point, timeStamp );
431 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
433 mEventHandler->FeedWheelEvent( wheelEvent );
436 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
438 mEventHandler->FeedKeyEvent( keyEvent );
441 void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
443 PositionSize positionSize = surface.GetPositionSize();
445 // let the core know the surface size has changed
446 mCore->SurfaceResized( positionSize.width, positionSize.height );
448 mResizedSignal.Emit( mAdaptor );
450 mNativeWindow = nativeWindow;
453 // flush the event queue to give the update-render thread chance
454 // to start processing messages for new camera setup etc as soon as possible
457 // this method blocks until the render thread has completed the replace.
458 mThreadController->ReplaceSurface(mSurface);
461 RenderSurface& Adaptor::GetSurface() const
466 void Adaptor::ReleaseSurfaceLock()
468 mSurface->ReleaseLock();
471 Dali::TtsPlayer Adaptor::GetTtsPlayer(Dali::TtsPlayer::Mode mode)
473 if(!mTtsPlayers[mode])
475 // Create the TTS player when it needed, because it can reduce launching time.
476 mTtsPlayers[mode] = TtsPlayer::New(mode);
479 return mTtsPlayers[mode];
482 bool Adaptor::AddIdle( CallbackBase* callback, bool forceAdd )
484 bool idleAdded(false);
486 // Only add an idle if the Adaptor is actually running
487 if( RUNNING == mState || READY == mState || forceAdd )
489 idleAdded = mCallbackManager->AddIdleCallback( callback );
495 void Adaptor::RemoveIdle( CallbackBase* callback )
497 mCallbackManager->RemoveIdleCallback( callback );
500 Dali::Adaptor& Adaptor::Get()
502 DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
503 return gThreadLocalAdaptor->mAdaptor;
506 bool Adaptor::IsAvailable()
508 return gThreadLocalAdaptor != NULL;
511 void Adaptor::SceneCreated()
513 mCore->SceneCreated();
516 Dali::Integration::Core& Adaptor::GetCore()
521 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
523 mThreadController->SetRenderRefreshRate( numberOfVSyncsPerRender );
526 void Adaptor::SetUseHardwareVSync( bool useHardware )
528 mVSyncMonitor->SetUseHardwareVSync( useHardware );
531 EglFactory& Adaptor::GetEGLFactory() const
533 DALI_ASSERT_DEBUG( mEglFactory && "EGL Factory not created" );
537 EglFactoryInterface& Adaptor::GetEGLFactoryInterface() const
542 Integration::GlAbstraction& Adaptor::GetGlAbstraction() const
544 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
548 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
550 return *mPlatformAbstraction;
553 Dali::Integration::GlAbstraction& Adaptor::GetGlesInterface()
558 TriggerEventInterface& Adaptor::GetProcessCoreEventsTrigger()
560 return *mNotificationTrigger;
563 TriggerEventFactoryInterface& Adaptor::GetTriggerEventFactoryInterface()
565 return mTriggerEventFactory;
568 SocketFactoryInterface& Adaptor::GetSocketFactoryInterface()
570 return mSocketFactory;
573 RenderSurface* Adaptor::GetRenderSurfaceInterface()
578 VSyncMonitorInterface* Adaptor::GetVSyncMonitorInterface()
580 return mVSyncMonitor;
583 TraceInterface& Adaptor::GetKernelTraceInterface()
585 return mKernelTracer;
588 TraceInterface& Adaptor::GetSystemTraceInterface()
590 return mSystemTracer;
593 PerformanceInterface* Adaptor::GetPerformanceInterface()
595 return mPerformanceInterface;
598 Integration::PlatformAbstraction& Adaptor::GetPlatformAbstraction() const
600 DALI_ASSERT_DEBUG( mPlatformAbstraction && "PlatformAbstraction not created" );
601 return *mPlatformAbstraction;
604 void Adaptor::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
606 mDragAndDropDetector = detector;
610 mEventHandler->SetDragAndDropDetector( detector );
614 void Adaptor::SetRotationObserver( RotationObserver* observer )
618 mEventHandler->SetRotationObserver( observer );
620 else if( mState == READY )
622 // Set once event handler exists
623 mDeferredRotationObserver = observer;
627 void Adaptor::DestroyTtsPlayer(Dali::TtsPlayer::Mode mode)
629 if(mTtsPlayers[mode])
631 mTtsPlayers[mode].Reset();
635 void Adaptor::SetMinimumPinchDistance(float distance)
637 if( mGestureManager )
639 mGestureManager->SetMinimumPinchDistance(distance);
643 Any Adaptor::GetNativeWindowHandle()
645 return mNativeWindow;
648 void Adaptor::SetUseRemoteSurface(bool useRemoteSurface)
650 mUseRemoteSurface = useRemoteSurface;
653 void Adaptor::AddObserver( LifeCycleObserver& observer )
655 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
657 if ( match == mObservers.end() )
659 mObservers.push_back( &observer );
663 void Adaptor::RemoveObserver( LifeCycleObserver& observer )
665 ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );
667 if ( match != mObservers.end() )
669 mObservers.erase( match );
673 void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event)
677 mCore->QueueEvent(event);
681 void Adaptor::ProcessCoreEvents()
685 if( mPerformanceInterface )
687 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_START );
690 mCore->ProcessEvents();
692 if( mPerformanceInterface )
694 mPerformanceInterface->AddMarker( PerformanceInterface::PROCESS_EVENTS_END );
699 void Adaptor::RequestUpdate( bool forceUpdate )
705 mThreadController->RequestUpdate();
709 case PAUSED_WHILE_HIDDEN:
711 // When Dali applications are partially visible behind the lock-screen,
712 // the indicator must be updated (therefore allow updates in the PAUSED state)
715 mThreadController->RequestUpdateOnce();
727 void Adaptor::RequestProcessEventsOnIdle( bool forceProcess )
729 // Only request a notification if the Adaptor is actually running
730 // and we haven't installed the idle notification
731 if( ( ! mNotificationOnIdleInstalled ) && ( RUNNING == mState || READY == mState || forceProcess ) )
733 mNotificationOnIdleInstalled = AddIdle( MakeCallback( this, &Adaptor::ProcessCoreEventsFromIdle ), forceProcess );
737 void Adaptor::OnWindowShown()
739 if ( PAUSED_WHILE_HIDDEN == mState )
741 // Adaptor can now be resumed
746 // Force a render task
751 void Adaptor::OnWindowHidden()
753 if ( RUNNING == mState )
757 // Adaptor cannot be resumed until the window is shown
758 mState = PAUSED_WHILE_HIDDEN;
762 // Dali::Internal::Adaptor::Adaptor::OnDamaged
763 void Adaptor::OnDamaged( const DamageArea& area )
765 // This is needed for the case where Dali window is partially obscured
766 RequestUpdate( false );
769 void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
771 // let the core know the surface size has changed
772 mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
774 mResizedSignal.Emit( mAdaptor );
777 void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
779 // flush the event queue to give the update-render thread chance
780 // to start processing messages for new camera setup etc as soon as possible
783 // this method blocks until the render thread has completed the resizing.
784 mThreadController->ResizeSurface();
787 void Adaptor::NotifySceneCreated()
789 GetCore().SceneCreated();
791 // Start thread controller after the scene has been created
792 mThreadController->Start();
794 // process after surface is created (registering to remote surface provider if required)
795 SurfaceInitialized();
800 void Adaptor::NotifyLanguageChanged()
802 mLanguageChangedSignal.Emit( mAdaptor );
805 void Adaptor::RenderOnce()
810 void Adaptor::RequestUpdateOnce()
812 if( mThreadController )
814 mThreadController->RequestUpdateOnce();
818 void Adaptor::IndicatorSizeChanged(int height)
820 // let the core know the indicator height is changed
821 mCore->SetTopMargin(height);
824 void Adaptor::ProcessCoreEventsFromIdle()
828 // the idle handle automatically un-installs itself
829 mNotificationOnIdleInstalled = false;
832 Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
834 mLanguageChangedSignal(),
838 mThreadController( NULL ),
839 mVSyncMonitor( NULL ),
843 mNativeWindow( nativeWindow ),
845 mPlatformAbstraction( NULL ),
846 mEventHandler( NULL ),
847 mCallbackManager( NULL ),
848 mNotificationOnIdleInstalled( false ),
849 mNotificationTrigger( NULL ),
850 mGestureManager( NULL ),
851 mDaliFeedbackPlugin(),
852 mFeedbackController( NULL ),
855 mDragAndDropDetector(),
856 mDeferredRotationObserver( NULL ),
857 mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
858 mPerformanceInterface( NULL ),
861 mTriggerEventFactory(),
862 mObjectProfiler( NULL ),
864 mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
865 mUseRemoteSurface( false )
867 DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
868 gThreadLocalAdaptor = this;
873 void Adaptor::SetViewMode( ViewMode viewMode )
875 mSurface->SetViewMode( viewMode );
876 mCore->SetViewMode( viewMode );
879 ViewMode Adaptor::GetViewMode() const
881 return mCore->GetViewMode();
884 void Adaptor::SetStereoBase( float stereoBase )
886 mCore->SetStereoBase( stereoBase );
889 float Adaptor::GetStereoBase() const
891 return mCore->GetStereoBase();
894 void Adaptor::SetRootLayoutDirection( std::string locale )
896 Dali::Stage stage = Dali::Stage::GetCurrent();
898 stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION,
899 static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
902 } // namespace Adaptor
904 } // namespace Internal