Enable to use GPU masking in image visual
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / image / image-visual.h
index bc94ffb..17d5a6e 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_IMAGE_VISUAL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -28,7 +28,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/image-loader/atlas-upload-observer.h>
 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
-#include <dali-toolkit/internal/visuals/texture-upload-observer.h>
+#include <dali-toolkit/internal/texture-manager/texture-upload-observer.h>
 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
 #include <dali-toolkit/internal/visuals/visual-url.h>
 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
@@ -224,11 +224,6 @@ protected:
   void OnSetTransform() override;
 
   /**
-   * @copydoc Visual::Base::IsResourceReady
-   */
-  bool IsResourceReady() const override;
-
-  /**
    * @copydoc Visual::Base::UpdateShader
    */
   void UpdateShader() override;
@@ -304,12 +299,29 @@ private:
   void RemoveTexture();
 
   /**
+   * @brief Compute texture size
+   */
+  void ComputeTextureSize();
+
+  /**
+   * @brief Compute mask texture ratio
+   * @return The Mask Texture Ratio
+   */
+  Vector2 ComputeMaskTextureRatio();
+
+  /**
    * Helper method to set individual values by index key.
    * @param[in] index The index key of the value
    * @param[in] value The value
    */
   void DoSetProperty(Property::Index index, const Property::Value& value);
 
+  /**
+   * @brief Check whether the mask texture is loaded or not.
+   * If MaskingType is MASKING_ON_LOADING and mask texture is failed to load, update shader.
+   */
+  void CheckMaskTexture();
+
 private:
   Vector4                            mPixelArea;
   WeakHandle<Actor>                  mPlacementActor;
@@ -319,6 +331,7 @@ private:
   Dali::ImageDimensions     mDesiredSize;
   TextureManager::TextureId mTextureId;
   TextureSet                mTextures;
+  Vector2                   mTextureSize;
 
   ImageVisualShaderFactory& mImageVisualShaderFactory;