X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fcommon%2Fadaptor-impl.cpp;h=e9dfd5eb2999df28ea10b5767e9d0f8b150cc33a;hb=c911568f2ad3cf8111a5b98b9195f9d126d8fc3d;hp=534fd994ff9d41b0ffed47e81a93ad25f173bac9;hpb=5a9caec92927aab9cbc40f4f9b81a7fde8f612e9;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index 534fd99..e9dfd5e 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,9 @@ // EXTERNAL INCLUDES #include +#include +#include +#include #include #include #include @@ -29,9 +32,7 @@ // INTERNAL INCLUDES #include -#if defined(NETWORK_ENABLED) -# include -#endif +#include #include #include @@ -55,6 +56,9 @@ #include #include +#include + +#include using Dali::TextAbstraction::FontClient; @@ -69,7 +73,7 @@ namespace Adaptor namespace { -__thread Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get +thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get } // unnamed namespace Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions ) @@ -114,12 +118,10 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration ) // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from // files automatically. -#if defined(NETWORK_ENABLED) if( mEnvironmentOptions->PerformanceServerRequired() ) { mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, *mEnvironmentOptions ); } -#endif mCallbackManager = CallbackManager::New(); @@ -136,7 +138,7 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration ) mGLES = new GlImplementation(); } - mEglFactory = new EglFactory(); + mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel() ); EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation(); @@ -187,6 +189,14 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration ) { Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount()); } + + // Set max texture size + if( mEnvironmentOptions->GetMaxTextureSize() > 0 ) + { + Dali::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() ); + } + + SetupSystemInformation(); } Adaptor::~Adaptor() @@ -389,47 +399,19 @@ void Adaptor::FeedKeyEvent( KeyEvent& keyEvent ) mEventHandler->FeedKeyEvent( keyEvent ); } -bool Adaptor::MoveResize( const PositionSize& positionSize ) -{ - PositionSize old = mSurface->GetPositionSize(); - - // just resize the surface. The driver should automatically resize the egl Surface (untested) - // EGL Spec says : EGL window surfaces need to be resized when their corresponding native window - // is resized. Implementations typically use hooks into the OS and native window - // system to perform this resizing on demand, transparently to the client. - mSurface->MoveResize( positionSize ); - - if(old.width != positionSize.width || old.height != positionSize.height) - { - SurfaceSizeChanged(positionSize); - } - - return true; -} - -void Adaptor::SurfaceResized( const PositionSize& positionSize ) +void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface ) { - PositionSize old = mSurface->GetPositionSize(); + PositionSize positionSize = surface.GetPositionSize(); - // Called by an application, when it has resized a window outside of Dali. - // The EGL driver automatically detects X Window resize calls, and resizes - // the EGL surface for us. - mSurface->MoveResize( positionSize ); + // let the core know the surface size has changed + mCore->SurfaceResized( positionSize.width, positionSize.height ); - if(old.width != positionSize.width || old.height != positionSize.height) - { - SurfaceSizeChanged(positionSize); - } -} + mResizedSignal.Emit( mAdaptor ); -void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface ) -{ mNativeWindow = nativeWindow; mSurface = &surface; - SurfaceSizeChanged(mSurface->GetPositionSize()); - - // flush the event queue to give update and render threads chance + // flush the event queue to give the update-render thread chance // to start processing messages for new camera setup etc as soon as possible ProcessCoreEvents(); @@ -471,6 +453,10 @@ bool Adaptor::AddIdle( CallbackBase* callback ) return idleAdded; } +void Adaptor::RemoveIdle( CallbackBase* callback ) +{ + mCallbackManager->RemoveIdleCallback( callback ); +} Dali::Adaptor& Adaptor::Get() { @@ -620,6 +606,11 @@ Any Adaptor::GetNativeWindowHandle() return mNativeWindow; } +void Adaptor::SetUseRemoteSurface(bool useRemoteSurface) +{ + mUseRemoteSurface = useRemoteSurface; +} + void Adaptor::AddObserver( LifeCycleObserver& observer ) { ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) ); @@ -719,20 +710,33 @@ void Adaptor::OnDamaged( const DamageArea& area ) RequestUpdate(); } -void Adaptor::SurfaceSizeChanged(const PositionSize& positionSize) +void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize ) { // let the core know the surface size has changed - mCore->SurfaceResized(positionSize.width, positionSize.height); + mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() ); mResizedSignal.Emit( mAdaptor ); } +void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize ) +{ + // flush the event queue to give the update-render thread chance + // to start processing messages for new camera setup etc as soon as possible + ProcessCoreEvents(); + + // this method blocks until the render thread has completed the resizing. + mThreadController->ResizeSurface(); +} + void Adaptor::NotifySceneCreated() { GetCore().SceneCreated(); // Start thread controller after the scene has been created mThreadController->Start(); + + // process after surface is created (registering to remote surface provider if required) + SurfaceInitialized(); } void Adaptor::NotifyLanguageChanged() @@ -740,6 +744,11 @@ void Adaptor::NotifyLanguageChanged() mLanguageChangedSignal.Emit( mAdaptor ); } +void Adaptor::RenderOnce() +{ + RequestUpdateOnce(); +} + void Adaptor::RequestUpdateOnce() { if( PAUSED_WHILE_HIDDEN != mState ) @@ -751,6 +760,12 @@ void Adaptor::RequestUpdateOnce() } } +void Adaptor::IndicatorSizeChanged(int height) +{ + // let the core know the indicator height is changed + mCore->SetTopMargin(height); +} + void Adaptor::ProcessCoreEventsFromIdle() { ProcessCoreEvents(); @@ -762,12 +777,13 @@ void Adaptor::ProcessCoreEventsFromIdle() Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions) : mResizedSignal(), mLanguageChangedSignal(), - mAdaptor(adaptor), - mState(READY), - mCore(NULL), - mThreadController(NULL), - mVSyncMonitor(NULL), + mAdaptor( adaptor ), + mState( READY ), + mCore( NULL ), + mThreadController( NULL ), + mVSyncMonitor( NULL ), mGLES( NULL ), + mGlSync( NULL ), mEglFactory( NULL ), mNativeWindow( nativeWindow ), mSurface( surface ), @@ -775,15 +791,23 @@ Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surfac mEventHandler( NULL ), mCallbackManager( NULL ), mNotificationOnIdleInstalled( false ), - mNotificationTrigger(NULL), - mGestureManager(NULL), + mNotificationTrigger( NULL ), + mGestureManager( NULL ), + mDaliFeedbackPlugin(), + mFeedbackController( NULL ), + mTtsPlayers(), mObservers(), mDragAndDropDetector(), - mDeferredRotationObserver(NULL), + mDeferredRotationObserver( NULL ), mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */), - mPerformanceInterface(NULL), - mObjectProfiler(NULL), - mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ) + mPerformanceInterface( NULL ), + mKernelTracer(), + mSystemTracer(), + mTriggerEventFactory(), + mObjectProfiler( NULL ), + mSocketFactory(), + mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ), + mUseRemoteSurface( false ) { DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" ); gThreadLocalAdaptor = this; @@ -812,6 +836,14 @@ float Adaptor::GetStereoBase() const return mCore->GetStereoBase(); } +void Adaptor::SetRootLayoutDirection( std::string locale ) +{ + Dali::Stage stage = Dali::Stage::GetCurrent(); + + stage.GetRootLayer().SetProperty( Dali::Actor::Property::LAYOUT_DIRECTION, + static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) ); +} + } // namespace Adaptor } // namespace Internal