X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Foffscreen%2Fcommon%2Foffscreen-application-impl.cpp;h=396dbc49889a0fbdbf1b4893668f0f286605996c;hb=9c2bae6039a7b0dc11e9e67ff51b3d608ccb3e50;hp=f2a9ed13c47b326a70886daef04ee43764007158;hpb=188e912a5a3ea204093c4667783f956a69625542;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/offscreen/common/offscreen-application-impl.cpp b/dali/internal/offscreen/common/offscreen-application-impl.cpp index f2a9ed1..396dbc4 100644 --- a/dali/internal/offscreen/common/offscreen-application-impl.cpp +++ b/dali/internal/offscreen/common/offscreen-application-impl.cpp @@ -15,20 +15,15 @@ * */ -// EXTERNAL INCLUDES -#include -#include -#include +// CLASS HEADER +#include // INTERNAL INCLUDES +#include #include -#include #include - -// CLASS HEADER -#include - -using Dali::Internal::Adaptor::ThreadMode; +#include +#include namespace Dali { @@ -36,6 +31,8 @@ namespace Dali namespace Internal { +using RenderMode = Dali::OffscreenApplication::RenderMode; + IntrusivePtr< OffscreenApplication > OffscreenApplication::New( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent, RenderMode renderMode ) { IntrusivePtr< OffscreenApplication > offscreenApplication = new OffscreenApplication( width, height, surface, isTranslucent, renderMode ); @@ -45,36 +42,32 @@ IntrusivePtr< OffscreenApplication > OffscreenApplication::New( uint16_t width, OffscreenApplication::OffscreenApplication( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent, RenderMode renderMode ) { // Generate a default window - auto windowFactory = Dali::Internal::GetOffscreenWindowFactory(); - IntrusivePtr windowPtr = windowFactory->CreateOffscreenWindow( width, height, surface, isTranslucent ).release(); - mDefaultWindow = Dali::OffscreenWindow( windowPtr.Get() ); + IntrusivePtr< Internal::OffscreenWindow > impl = Internal::OffscreenWindow::New( width, height, surface, isTranslucent ); + mDefaultWindow = Dali::OffscreenWindow( impl.Get() ); - mAdaptor = Dali::Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( windowPtr.Get() ), windowPtr->GetSurface(), - Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS, NULL, - renderMode == RenderMode::AUTO ? ThreadMode::NORMAL : ThreadMode::RUN_IF_REQUESTED ); + mAdaptor.reset( Dali::Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( impl.Get() ), impl->GetSurface(), NULL, + renderMode == RenderMode::AUTO ? Dali::Internal::Adaptor::ThreadMode::NORMAL : Dali::Internal::Adaptor::ThreadMode::RUN_IF_REQUESTED ) ); // Initialize default window - windowPtr->Initialize( true ); -} - -OffscreenApplication::~OffscreenApplication() -{ - delete mAdaptor; - mAdaptor = nullptr; + impl->Initialize( true ); } void OffscreenApplication::Start() { - // Start the adaptor - mAdaptor->Start(); - mInitSignal.Emit(); - mAdaptor->NotifySceneCreated(); + // Start the adaptor + mAdaptor->Start(); + + Dali::OffscreenApplication handle( this ); + mInitSignal.Emit(); + mAdaptor->NotifySceneCreated(); } void OffscreenApplication::Stop() { // Stop the adaptor mAdaptor->Stop(); + + Dali::OffscreenApplication handle( this ); mTerminateSignal.Emit(); }