[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / visual-factory-impl.h
index f038301..76bacf9 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_VISUAL_FACTORY_IMPL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  */
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/base-object.h>
+#include <dali/integration-api/adaptor-framework/shader-precompiler.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
@@ -35,6 +36,7 @@ namespace Internal
 {
 class VisualFactoryCache;
 class ImageVisualShaderFactory;
+class TextVisualShaderFactory;
 
 /**
  * @copydoc Toolkit::VisualFactory
@@ -58,6 +60,13 @@ public:
   void OnStyleChangedSignal(Toolkit::StyleManager styleManager, StyleChange::Type type);
 
   /**
+   * @brief BrokenImageChanged callback
+   *
+   * @param[in] styleManager Handle for style manager.
+   */
+  void OnBrokenImageChangedSignal(Toolkit::StyleManager styleManager);
+
+  /**
    * @copydoc Toolkit::VisualFactory::CreateVisual( const Property::Map& )
    */
   Toolkit::Visual::Base CreateVisual(const Property::Map& propertyMap);
@@ -78,6 +87,16 @@ public:
   bool GetPreMultiplyOnLoad() const;
 
   /**
+   * @copydoc Toolkit::VisualFactory::DiscardVisual()
+   */
+  void DiscardVisual(Toolkit::Visual::Base visual);
+
+  /**
+   * @copydoc Toolkit::VisualFactory::UsePreCompiledShader()
+   */
+  void UsePreCompiledShader();
+
+  /**
    * @return the reference to texture manager
    */
   Internal::TextureManager& GetTextureManager();
@@ -90,6 +109,18 @@ protected:
 
 private:
   /**
+   * @brief Set the Broken Image url
+   * @param[in] styleManager The instance of StyleManager
+   */
+  void SetBrokenImageUrl(Toolkit::StyleManager& styleManager);
+
+  /**
+   * @brief Get the default shader source.
+   * @param[in] shaders shaderList for precompile
+   */
+  void GetPreCompiledShader(RawShaderData& shaders);
+
+  /**
    * Get the factory cache, creating it if necessary.
    */
   Internal::VisualFactoryCache& GetFactoryCache();
@@ -99,6 +130,21 @@ private:
    */
   ImageVisualShaderFactory& GetImageVisualShaderFactory();
 
+  /**
+   * Get the text visual shader factory, creating it if necessary.
+   */
+  TextVisualShaderFactory& GetTextVisualShaderFactory();
+
+  /**
+   * @brief Callbacks called for clear discarded visuals.
+   */
+  void OnDiscardCallback();
+
+  /**
+   * @brief Register idle callback for discard visuals if need.
+   */
+  void RegisterDiscardCallback();
+
   VisualFactory(const VisualFactory&) = delete;
 
   VisualFactory& operator=(const VisualFactory& rhs) = delete;
@@ -106,9 +152,14 @@ private:
 private:
   std::unique_ptr<VisualFactoryCache>       mFactoryCache;
   std::unique_ptr<ImageVisualShaderFactory> mImageVisualShaderFactory;
+  std::unique_ptr<TextVisualShaderFactory>  mTextVisualShaderFactory;
   SlotDelegate<VisualFactory>               mSlotDelegate;
+  CallbackBase*                             mIdleCallback;
+  using DiscardedVisualContainer = std::vector<Toolkit::Visual::Base>;
+  DiscardedVisualContainer mDiscardedVisuals{};
   bool                                      mDebugEnabled : 1;
   bool                                      mPreMultiplyOnLoad : 1; ///< Local store for this flag
+  bool                                      mPrecompiledShaderRequested : 1;
 };
 
 /**