From 22b6cdee7ed55d63eac35b64b304fc771052fcee Mon Sep 17 00:00:00 2001 From: Xiangyin Ma Date: Thu, 22 Dec 2016 15:50:47 +0000 Subject: [PATCH] SuperBlurView bug fix: alpha uniform gets wrong value from constraint Change-Id: I4a0168b9c942e5a9d8b5d9b751ac29b4364f62ce --- .../super-blur-view/super-blur-view-impl.cpp | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp index 3141edc..4e74276 100644 --- a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp +++ b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp @@ -162,20 +162,20 @@ void SuperBlurView::OnInitialize() void SuperBlurView::SetImage(Image inputImage) { - if( mTargetSize == Vector2::ZERO || mInputImage == inputImage) + mInputImage = inputImage; + if( mTargetSize == Vector2::ZERO ) { return; } ClearBlurResource(); - mInputImage = inputImage; Actor self( Self() ); mVisuals[0] = Toolkit::VisualFactory::Get().CreateVisual( mInputImage ); RegisterVisual( 0, mVisuals[0] ); // Will clean up previously registered visuals for this index. mVisuals[0].SetDepthIndex(0); - SetShaderEffect( mVisuals[0] ); + // custom shader is not applied on the original image. BlurImage( 0, inputImage); for(unsigned int i=1; i( renderer, index, ActorOpacityConstraint(mBlurLevels, i-1) ); - constraint.AddSource( Source( self, mBlurStrengthPropertyIndex ) ); - constraint.Apply(); + int depthIndex = renderer.GetProperty(Renderer::Property::DEPTH_INDEX); + if( depthIndex > 0 ) + { + Property::Index index = renderer.RegisterProperty( ALPHA_UNIFORM_NAME, 0.f ); + Constraint constraint = Constraint::New( renderer, index, ActorOpacityConstraint(mBlurLevels, depthIndex-1) ); + constraint.AddSource( Source( self, mBlurStrengthPropertyIndex ) ); + constraint.Apply(); + } } } -- 2.7.4