X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fcommon%2Fcore-impl.cpp;h=313fa72f2a44db50ef2232520619a1f34f6d6716;hb=2b10280985738c74efa2aa0fb956a837c69acee6;hp=982f7d33fc138a670998439defad9f260d45c774;hpb=c72d83ab9ed29f43e69aa6959a2248e63bd1bcf8;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index 982f7d3..313fa72 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 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. @@ -22,32 +22,32 @@ #include #include #include -#include +#include #include +#include #include + #include -#include #include -#include #include -#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include + +#include +#include #include #include @@ -56,6 +56,7 @@ using Dali::Internal::SceneGraph::RenderManager; using Dali::Internal::SceneGraph::DiscardQueue; using Dali::Internal::SceneGraph::RenderQueue; using Dali::Internal::SceneGraph::TextureCache; +using Dali::Internal::SceneGraph::TextureCacheDispatcher; namespace { @@ -92,12 +93,10 @@ Core::Core( RenderController& renderController, PlatformAbstraction& platform, mUpdateManager(NULL), mRenderManager(NULL), mDiscardQueue(NULL), - mResourcePostProcessQueue(), + mTextureUploadedQueue(), mNotificationManager(NULL), - mFontFactory(NULL), mImageFactory(NULL), mShaderFactory(NULL), - mEmojiFactory(NULL), mIsActive(true), mProcessingEvent(false) { @@ -113,35 +112,32 @@ Core::Core( RenderController& renderController, PlatformAbstraction& platform, mPropertyNotificationManager = PropertyNotificationManager::New(); - std::vector< ResourcePostProcessRequest> init; - mResourcePostProcessQueue = new ResourcePostProcessList(init); + mTextureUploadedQueue = new LockedResourceQueue; - mRenderManager = RenderManager::New( glAbstraction, *mResourcePostProcessQueue ); + mRenderManager = RenderManager::New( glAbstraction, glSyncAbstraction, *mTextureUploadedQueue ); RenderQueue& renderQueue = mRenderManager->GetRenderQueue(); TextureCache& textureCache = mRenderManager->GetTextureCache(); - ResourcePolicy::Discardable discardPolicy = ResourcePolicy::DISCARD; + ResourcePolicy::Discardable discardPolicy = ResourcePolicy::OWNED_DISCARD; if( dataRetentionPolicy == ResourcePolicy::DALI_RETAINS_ALL_DATA ) { - discardPolicy = ResourcePolicy::RETAIN; + discardPolicy = ResourcePolicy::OWNED_RETAIN; } textureCache.SetDiscardBitmapsPolicy(discardPolicy); + mTextureCacheDispatcher = new SceneGraph::TextureCacheDispatcher( renderQueue, textureCache ); + mDiscardQueue = new DiscardQueue( renderQueue ); mResourceManager = new ResourceManager( mPlatform, *mNotificationManager, - textureCache, - *mResourcePostProcessQueue, - *mRenderManager, + *mTextureCacheDispatcher, + *mTextureUploadedQueue, *mDiscardQueue, renderQueue ); - mTouchResampler = TouchResampler::New(); - mUpdateManager = new UpdateManager( *mNotificationManager, - glSyncAbstraction, *mAnimationPlaylist, *mPropertyNotificationManager, *mResourceManager, @@ -149,26 +145,26 @@ Core::Core( RenderController& renderController, PlatformAbstraction& platform, renderController, *mRenderManager, renderQueue, - textureCache, - *mTouchResampler ); + *mTextureCacheDispatcher ); + + mRenderManager->SetShaderSaver( *mUpdateManager ); mStage = IntrusivePtr( Stage::New( *mAnimationPlaylist, *mPropertyNotificationManager, *mUpdateManager, *mNotificationManager ) ); // This must be called after stage is created but before stage initialization - mRelayoutController = IntrusivePtr< RelayoutController >( new RelayoutController() ); + mRelayoutController = IntrusivePtr< RelayoutController >( new RelayoutController( mRenderController ) ); mStage->Initialize(); - mResourceClient = new ResourceClient( *mResourceManager, *mStage, dataRetentionPolicy ); + mResourceClient = new ResourceClient( *mResourceManager, *mStage ); mGestureEventProcessor = new GestureEventProcessor(*mStage, gestureManager, mRenderController); mEventProcessor = new EventProcessor(*mStage, *mNotificationManager, *mGestureEventProcessor); - mFontFactory = new FontFactory(*mResourceClient); mImageFactory = new ImageFactory( *mResourceClient ); - mShaderFactory = new ShaderFactory(*mResourceClient); + mShaderFactory = new ShaderFactory(); + mUpdateManager->SetShaderSaver( *mShaderFactory ); mShaderFactory->LoadDefaultShaders(); - mEmojiFactory = new EmojiFactory(); GetImplementation(Dali::TypeRegistry::Get()).CallInitFunctions(); } @@ -188,7 +184,11 @@ Core::~Core() // clear the thread local storage first // allows core to be created / deleted many times in the same thread (how TET cases work). // Do this before mStage.Reset() so Stage::IsInstalled() returns false - ThreadLocalStorage::Get().Remove(); + ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal(); + if( tls ) + { + tls->Remove(); + } // Stop relayout requests being raised on stage destruction mRelayoutController.Reset(); @@ -202,17 +202,15 @@ Core::~Core() delete mEventProcessor; delete mGestureEventProcessor; delete mNotificationManager; - delete mFontFactory; delete mImageFactory; delete mShaderFactory; delete mResourceClient; delete mResourceManager; + delete mDiscardQueue; + delete mTextureCacheDispatcher; delete mUpdateManager; - delete mTouchResampler; - delete mEmojiFactory; delete mRenderManager; - delete mDiscardQueue; - delete mResourcePostProcessQueue; + delete mTextureUploadedQueue; } Integration::ContextNotifierInterface* Core::GetContextNotifier() @@ -225,7 +223,6 @@ void Core::RecoverFromContextLoss() DALI_LOG_INFO(gCoreFilter, Debug::Verbose, "Core::RecoverFromContextLoss()\n"); mImageFactory->RecoverFromContextLoss(); // Reload images from files - mFontFactory->RecoverFromContextLoss(); // Reload glyphs from cache into new atlas mStage->GetRenderTaskList().RecoverFromContextLoss(); // Re-trigger render-tasks } @@ -239,15 +236,14 @@ void Core::ContextDestroyed() mRenderManager->ContextDestroyed(); } -void Core::SurfaceResized(unsigned int width, unsigned int height) +void Core::SurfaceResized( unsigned int width, unsigned int height ) { - mStage->SetSize(width, height); + mStage->SetSize( width, height ); + mRelayoutController->SetStageSize( width, height ); } -void Core::SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical) +void Core::SetDpi( unsigned int dpiHorizontal, unsigned int dpiVertical ) { - mPlatform.SetDpi( dpiHorizontal, dpiVertical ); - mFontFactory->SetDpi( dpiHorizontal, dpiVertical); mStage->SetDpi( Vector2( dpiHorizontal , dpiVertical) ); } @@ -317,12 +313,13 @@ void Core::ProcessEvents() // Guard against calls to ProcessEvents() during ProcessEvents() if( mProcessingEvent ) { - DALI_LOG_ERROR( "ProcessEvents should not be called from within ProcessEvents!" ); + DALI_LOG_ERROR( "ProcessEvents should not be called from within ProcessEvents!\n" ); mRenderController.RequestProcessEventsOnIdle(); return; } mProcessingEvent = true; + mRelayoutController->SetProcessingCoreEvents( true ); // Signal that any messages received will be flushed soon mUpdateManager->EventProcessingStarted(); @@ -343,32 +340,25 @@ void Core::ProcessEvents() // Flush discard queue for image factory mImageFactory->FlushReleaseQueue(); - // send text requests if required - mFontFactory->SendTextRequests(); - // Flush any queued messages for the update-thread const bool messagesToProcess = mUpdateManager->FlushQueue(); // Check if the touch or gestures require updates. - const bool touchNeedsUpdate = mTouchResampler->NeedsUpdate(); const bool gestureNeedsUpdate = mGestureEventProcessor->NeedsUpdate(); - if( messagesToProcess || touchNeedsUpdate || gestureNeedsUpdate ) + if( messagesToProcess || gestureNeedsUpdate ) { // tell the render controller to keep update thread running mRenderController.RequestUpdate(); } } + mRelayoutController->SetProcessingCoreEvents( false ); + // ProcessEvents() may now be called again mProcessingEvent = false; } -void Core::UpdateTouchData(const Integration::TouchData& touch) -{ - mTouchResampler->SendTouchData( touch ); -} - unsigned int Core::GetMaximumUpdateCount() const { return MAXIMUM_UPDATE_COUNT; @@ -434,11 +424,6 @@ ResourceClient& Core::GetResourceClient() return *(mResourceClient); } -FontFactory& Core::GetFontFactory() -{ - return *(mFontFactory); -} - ImageFactory& Core::GetImageFactory() { return *(mImageFactory); @@ -454,11 +439,6 @@ GestureEventProcessor& Core::GetGestureEventProcessor() return *(mGestureEventProcessor); } -EmojiFactory& Core::GetEmojiFactory() -{ - return *mEmojiFactory; -} - RelayoutController& Core::GetRelayoutController() { return *(mRelayoutController.Get());