+
+ if(mInputTexture)
+ {
+ SetTexture(mInputTexture);
+ }
+ }
+
+ Control::OnSizeSet(targetSize);
+}
+
+void SuperBlurView::OnSceneConnection(int depth)
+{
+ if(mTargetSize == Vector2::ZERO)
+ {
+ return;
+ }
+
+ // Exception to the rule, chaining up first ensures visuals have SetOnScene called to create their renderers
+ Control::OnSceneConnection(depth);
+
+ Actor self = Self();
+
+ for(unsigned int i = 0; i < mBlurLevels + 1; i++)
+ {
+ mRenderers[i] = CreateRenderer(BASIC_VERTEX_SOURCE, SHADER_SUPER_BLUR_VIEW_FRAG);
+ mRenderers[i].SetProperty(Dali::Renderer::Property::DEPTH_INDEX, (int)i);
+ self.AddRenderer(mRenderers[i]);
+
+ if(i > 0)
+ {
+ Renderer renderer = mRenderers[i];
+ Property::Index index = renderer.RegisterUniqueProperty(ALPHA_UNIFORM_NAME, 0.f);
+ Constraint constraint = Constraint::New<float>(renderer, index, ActorOpacityConstraint(mBlurLevels, i - 1));
+ constraint.AddSource(Source(self, mBlurStrengthPropertyIndex));
+ constraint.Apply();
+ }
+ }
+
+ if(mInputTexture)
+ {
+ SetRendererTexture(mRenderers[0], mInputTexture);
+ unsigned int i = 1;
+ for(; i < mBlurLevels; i++)
+ {
+ SetRendererTexture(mRenderers[i], mBlurredImage[i - 1]);
+ }
+ SetRendererTexture(mRenderers[i], mBlurredImage[i - 1]);
+ }
+}
+
+void SuperBlurView::OnSceneDisconnection()
+{
+ for(unsigned int i = 0; i < mBlurLevels + 1; i++)
+ {
+ Self().RemoveRenderer(mRenderers[i]);
+ mRenderers[i].Reset();
+ }
+
+ Control::OnSceneDisconnection();
+}
+
+Vector3 SuperBlurView::GetNaturalSize()
+{
+ if(mInputTexture)
+ {
+ return Vector3(mInputTexture.GetWidth(), mInputTexture.GetHeight(), 0.f);