CanvasRenderer: Add RemoveAllDrawables() API 82/261182/8
authorJunsuChoi <jsuya.choi@samsung.com>
Tue, 13 Jul 2021 03:12:20 +0000 (12:12 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Mon, 26 Jul 2021 07:33:48 +0000 (16:33 +0900)
Add an API that removes the all drawables registered with AddDrawable().

Change-Id: I6483f99a7acc106022fbd4eec3fbf2cab100f1e0

dali/devel-api/adaptor-framework/canvas-renderer.cpp
dali/devel-api/adaptor-framework/canvas-renderer.h
dali/internal/canvas-renderer/common/canvas-renderer-impl.cpp
dali/internal/canvas-renderer/common/canvas-renderer-impl.h
dali/internal/canvas-renderer/generic/canvas-renderer-impl-generic.cpp
dali/internal/canvas-renderer/generic/canvas-renderer-impl-generic.h
dali/internal/canvas-renderer/tizen/canvas-renderer-impl-tizen.cpp
dali/internal/canvas-renderer/tizen/canvas-renderer-impl-tizen.h
dali/internal/canvas-renderer/ubuntu/canvas-renderer-impl-ubuntu.cpp
dali/internal/canvas-renderer/ubuntu/canvas-renderer-impl-ubuntu.h

index 1ed7512..998870e 100644 (file)
@@ -73,6 +73,11 @@ bool CanvasRenderer::RemoveDrawable(Drawable& drawable)
   return GetImplementation(*this).RemoveDrawable(drawable);
 }
 
+bool CanvasRenderer::RemoveAllDrawables()
+{
+  return GetImplementation(*this).RemoveAllDrawables();
+}
+
 bool CanvasRenderer::SetSize(const Vector2& size)
 {
   return GetImplementation(*this).SetSize(size);
index 85e898b..8896223 100644 (file)
@@ -110,6 +110,12 @@ public:
   bool RemoveDrawable(Drawable& drawable);
 
   /**
+   * @brief Remove all drawable objects added to the CanvasRenderer.
+   * @return Returns True when it's successful. False otherwise.
+   */
+  bool RemoveAllDrawables();
+
+  /**
    * @brief Returns the PixelBuffer, which is the Render buffer of Canvas.
    *
    * @return Returns the pixel buffer.
index 14892a2..4ed9de9 100644 (file)
@@ -63,6 +63,11 @@ bool CanvasRenderer::RemoveDrawable(Dali::CanvasRenderer::Drawable& drawable)
   return false;
 }
 
+bool CanvasRenderer::RemoveAllDrawables()
+{
+  return false;
+}
+
 bool CanvasRenderer::SetSize(const Vector2& size)
 {
   return false;
index 6f12b51..23816d5 100644 (file)
@@ -79,6 +79,11 @@ public:
   virtual bool RemoveDrawable(Dali::CanvasRenderer::Drawable& drawable);
 
   /**
+   * @copydoc Dali::CanvasRenderer::RemoveAllDrawables()
+   */
+  virtual bool RemoveAllDrawables();
+
+  /**
    * @copydoc Dali::CanvasRenderer::SetSize()
    */
   virtual bool SetSize(const Vector2& size);
index cedccec..b1a48a3 100644 (file)
@@ -85,6 +85,11 @@ bool CanvasRendererGeneric::RemoveDrawable(Dali::CanvasRenderer::Drawable& drawa
   return false;
 }
 
+bool CanvasRendererGeneric::RemoveAllDrawables()
+{
+  return false;
+}
+
 bool CanvasRendererGeneric::SetSize(const Vector2& size)
 {
   return false;
index 9fea46f..8a96737 100644 (file)
@@ -77,6 +77,11 @@ public:
   bool RemoveDrawable(Dali::CanvasRenderer::Drawable& drawable) override;
 
   /**
+   * @copydoc Dali::CanvasRenderer::RemoveAllDrawables()
+   */
+  bool RemoveAllDrawables() override;
+
+  /**
    * @copydoc Dali::CanvasRenderer::SetSize()
    */
   bool SetSize(const Vector2& size) override;
index 72fe081..86a8a77 100644 (file)
@@ -286,6 +286,24 @@ bool CanvasRendererTizen::RemoveDrawable(Dali::CanvasRenderer::Drawable& drawabl
   return false;
 }
 
+bool CanvasRendererTizen::RemoveAllDrawables()
+{
+#ifdef THORVG_SUPPORT
+  for(auto& it : mDrawables)
+  {
+    Internal::Adaptor::Drawable& drawableImpl = GetImplementation(it);
+    drawableImpl.SetAdded(false);
+  }
+
+  mDrawables.clear();
+  mChanged = true;
+
+  return true;
+#else
+  return false;
+#endif
+}
+
 bool CanvasRendererTizen::SetSize(const Vector2& size)
 {
   if(size.width < 1.0f || size.height < 1.0f)
index e7fae0e..9326639 100644 (file)
@@ -82,6 +82,11 @@ public:
   bool RemoveDrawable(Dali::CanvasRenderer::Drawable& drawable) override;
 
   /**
+   * @copydoc Dali::CanvasRenderer::RemoveAllDrawables()
+   */
+  bool RemoveAllDrawables() override;
+
+  /**
    * @copydoc Dali::CanvasRenderer::SetSize()
    */
   bool SetSize(const Vector2& size) override;
index 1d9cc02..7a88442 100644 (file)
@@ -286,6 +286,24 @@ bool CanvasRendererUbuntu::RemoveDrawable(Dali::CanvasRenderer::Drawable& drawab
   return false;
 }
 
+bool CanvasRendererUbuntu::RemoveAllDrawables()
+{
+#ifdef THORVG_SUPPORT
+  for(auto& it : mDrawables)
+  {
+    Internal::Adaptor::Drawable& drawableImpl = GetImplementation(it);
+    drawableImpl.SetAdded(false);
+  }
+
+  mDrawables.clear();
+  mChanged = true;
+
+  return true;
+#else
+  return false;
+#endif
+}
+
 bool CanvasRendererUbuntu::SetSize(const Vector2& size)
 {
   if(size.width < 1.0f || size.height < 1.0f)
index c5224f0..4553cf6 100644 (file)
@@ -82,6 +82,11 @@ public:
   bool RemoveDrawable(Dali::CanvasRenderer::Drawable& drawable) override;
 
   /**
+   * @copydoc Dali::CanvasRenderer::RemoveAllDrawables()
+   */
+  bool RemoveAllDrawables() override;
+
+  /**
    * @copydoc Dali::CanvasRenderer::SetSize()
    */
   bool SetSize(const Vector2& size) override;