From: Adeel Kazmi Date: Tue, 15 Nov 2016 15:40:36 +0000 (-0800) Subject: Merge "Visual bases checks if visual already staged before adding to stage" into... X-Git-Tag: dali_1.2.15~9 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=d1cfad4519366d33c73f7152451735e664ad241c;hp=928f30d2caf2775c5bcbfd84ceb4bf37ca29f020 Merge "Visual bases checks if visual already staged before adding to stage" into devel/master --- diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index 54527de..084491a 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -522,7 +522,7 @@ TextureSet ImageVisual::CreateTextureSet( Vector4& textureRect, const std::strin void ImageVisual::InitializeRenderer( const std::string& imageUrl ) { - mImpl->mRenderer.Reset(); + DALI_ASSERT_DEBUG( !mImpl->mRenderer && "Renderer should have been removed from stage and already reset before initialization" ); mImageUrl = imageUrl; mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED; @@ -586,8 +586,9 @@ void ImageVisual::InitializeRenderer( const std::string& imageUrl ) void ImageVisual::InitializeRenderer( const Image& image ) { + DALI_ASSERT_DEBUG( !mImpl->mRenderer && "Renderer should have been removed from stage and already reset before initialization" ); + mImpl->mFlags &= ~Impl::IS_FROM_CACHE; - mImpl->mRenderer.Reset(); // don't reuse CreateTextureSet TextureSet textures = TextureSet::New(); diff --git a/dali-toolkit/internal/visuals/visual-base-impl.cpp b/dali-toolkit/internal/visuals/visual-base-impl.cpp index 9cd41e0..e8ed4a3 100644 --- a/dali-toolkit/internal/visuals/visual-base-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-base-impl.cpp @@ -130,15 +130,18 @@ float Visual::Base::GetDepthIndex() const void Visual::Base::SetOnStage( Actor& actor ) { - // To display the actor correctly, renderer should not be added to actor until all required resources are ready. - // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing. - DoSetOnStage( actor ); - - if( mImpl->mRenderer ) + if( !IsOnStage() ) { - mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled()); - mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex ); - mImpl->mFlags |= Impl::IS_ON_STAGE; // Only sets the flag if renderer exists + // To display the actor correctly, renderer should not be added to actor until all required resources are ready. + // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing. + DoSetOnStage( actor ); + + if( mImpl->mRenderer ) + { + mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled()); + mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex ); + mImpl->mFlags |= Impl::IS_ON_STAGE; // Only sets the flag if renderer exists + } } } diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index a01cc5e..90b3bb6 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -803,6 +803,7 @@ void Control::EnableVisual( Property::Index index, bool enable ) { if ( (*iter)->enabled == enable ) { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Visual Already enabled set (%s) \n", enable?"enabled":"disabled"); return; } @@ -812,11 +813,12 @@ void Control::EnableVisual( Property::Index index, bool enable ) { if ( enable ) { - + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting Visual(%d) on stage \n", index ); Toolkit::GetImplementation((*iter)->visual).SetOnStage( parentActor ); } else { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting Visual(%d) off stage \n", index ); Toolkit::GetImplementation((*iter)->visual).SetOffStage( parentActor ); // No need to call if control not staged. } } @@ -1084,11 +1086,14 @@ void Control::EmitKeyInputFocusSignal( bool focusGained ) void Control::OnStageConnection( int depth ) { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageConnection number of registered visuals(%d)\n", mImpl->mVisuals.Size() ); + for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++) { // Check whether the visual is empty and enabled if( (*iter)->visual && (*iter)->enabled ) { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageConnection Setting visual(%d) on stage\n", (*iter)->index ); Actor self( Self() ); Toolkit::GetImplementation((*iter)->visual).SetOnStage( self ); } @@ -1102,6 +1107,7 @@ void Control::OnStageDisconnection() // Check whether the visual is empty if( (*iter)->visual ) { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageDisconnection Setting visual(%d) off stage\n", (*iter)->index ); Actor self( Self() ); Toolkit::GetImplementation((*iter)->visual).SetOffStage( self ); }