[dali_2.3.22] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / super-blur-view / super-blur-view-impl.cpp
index 6325e62..4aedfc0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -147,12 +147,9 @@ void SuperBlurView::OnInitialize()
 {
   Actor self(Self());
 
-  mBlurStrengthPropertyIndex = self.RegisterProperty("blurStrength", 0.f);
+  mBlurStrengthPropertyIndex = self.RegisterUniqueProperty("blurStrength", 0.f);
 
-  DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
-    return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
-  });
+  self.SetProperty(DevelControl::Property::ACCESSIBILITY_ROLE, Dali::Accessibility::Role::FILLER);
 }
 
 void SuperBlurView::SetTexture(Texture texture)
@@ -195,7 +192,7 @@ void SuperBlurView::SetBlurStrength(float blurStrength)
 
 float SuperBlurView::GetCurrentBlurStrength() const
 {
-  float blurStrength;
+  float blurStrength = 0.0f;
   (Self().GetProperty(mBlurStrengthPropertyIndex)).Get(blurStrength);
 
   return blurStrength;
@@ -307,7 +304,7 @@ void SuperBlurView::OnSceneConnection(int depth)
     if(i > 0)
     {
       Renderer        renderer   = mRenderers[i];
-      Property::Index index      = renderer.RegisterProperty(ALPHA_UNIFORM_NAME, 0.f);
+      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();
@@ -356,20 +353,21 @@ void SuperBlurView::SetProperty(BaseObject* object, Property::Index propertyInde
 
     if(propertyIndex == Toolkit::SuperBlurView::Property::IMAGE_URL)
     {
-      value.Get(superBlurViewImpl.mUrl);
-
-      PixelData pixels = SyncImageLoader::Load(superBlurViewImpl.mUrl);
-
-      if(pixels)
-      {
-        Texture texture = Texture::New(TextureType::TEXTURE_2D, pixels.GetPixelFormat(), pixels.GetWidth(), pixels.GetHeight());
-        texture.Upload(pixels, 0, 0, 0, 0, pixels.GetWidth(), pixels.GetHeight());
-
-        superBlurViewImpl.SetTexture(texture);
-      }
-      else
+      if(DALI_LIKELY(value.Get(superBlurViewImpl.mUrl)))
       {
-        DALI_LOG_ERROR("Cannot create image from property value\n");
+        PixelData pixels = SyncImageLoader::Load(superBlurViewImpl.mUrl);
+
+        if(pixels)
+        {
+          Texture texture = Texture::New(TextureType::TEXTURE_2D, pixels.GetPixelFormat(), pixels.GetWidth(), pixels.GetHeight());
+          texture.Upload(pixels, 0, 0, 0, 0, pixels.GetWidth(), pixels.GetHeight());
+
+          superBlurViewImpl.SetTexture(texture);
+        }
+        else
+        {
+          DALI_LOG_ERROR("Cannot create image from property value\n");
+        }
       }
     }
   }