#include <dali-toolkit/internal/visuals/npatch-loader.h>
#include <dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h>
#include <dali-toolkit/internal/visuals/texture-manager-impl.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
namespace Dali
{
GRADIENT_SHADER_RADIAL_USER_SPACE_BORDERLINE,
GRADIENT_SHADER_RADIAL_USER_SPACE_ROUNDED_BORDERLINE,
IMAGE_SHADER,
- IMAGE_SHADER_ATLAS_DEFAULT_WRAP,
- IMAGE_SHADER_ATLAS_CUSTOM_WRAP,
IMAGE_SHADER_ROUNDED_CORNER,
IMAGE_SHADER_BORDERLINE,
IMAGE_SHADER_ROUNDED_BORDERLINE,
+ IMAGE_SHADER_ATLAS_DEFAULT_WRAP,
+ IMAGE_SHADER_ATLAS_CUSTOM_WRAP,
+ NATIVE_IMAGE_SHADER,
+ NATIVE_IMAGE_SHADER_ROUNDED_CORNER,
+ NATIVE_IMAGE_SHADER_BORDERLINE,
+ NATIVE_IMAGE_SHADER_ROUNDED_BORDERLINE,
NINE_PATCH_SHADER,
NINE_PATCH_MASK_SHADER,
TEXT_SHADER_MULTI_COLOR_TEXT,
static Geometry CreateGridGeometry(Uint16Pair gridSize);
/**
- * @brief Returns a new Texture to use when a visual has failed to correctly render
- * @return The broken image texture.
- */
- Texture GetBrokenVisualImage();
-
- /**
* @copydoc Toolkit::VisualFactory::SetPreMultiplyOnLoad()
*/
void SetPreMultiplyOnLoad(bool preMultiply);
/**
* @brief Set an image to be used when a visual has failed to correctly render
- * @param[in] brokenImageUrl The broken image url.
+ * @param[in] brokenImageUrlList The broken image url list
+ */
+ void SetBrokenImageUrl(std::string& defaultBrokenUrl, const std::vector<std::string>& brokenImageUrlList);
+
+ /**
+ * @brief Update the broken image Renderer object
+ * @param[in,out] renderer renderer for broken image
+ * @param[in] size the size of actor
*/
- void SetBrokenImageUrl(const std::string& brokenImageUrl);
+ void UpdateBrokenImageRenderer(Renderer& renderer, const Vector2& size);
public:
/**
VisualFactoryCache& operator=(const VisualFactoryCache& rhs);
private:
+ /**
+ * @brief Returns a cached Texture to use when a visual has failed to correctly render
+ * @param[in] brokenIndex The index of broken image
+ *
+ * @return The broken image texture.
+ */
+ Texture GetBrokenVisualImage(uint32_t brokenIndex);
+
+ /**
+ * @brief Gets the Proper broken image index
+ * @param[in] size The size of actor
+ *
+ * @return The index of broken image
+ */
+ int32_t GetProperBrokenImageIndex(const Vector2& size);
+
+ /**
+ * @brief Apply a texture and uniforms
+ *
+ * @param[in,out] renderer The renderer for broken image
+ * @param[in] index The index of broken image
+ */
+ void ApplyTextureAndUniforms(Renderer& renderer, int index);
+
+ /**
+ * @brief Gets a geometry for npatch image
+ *
+ * @param[in] index the index of broken image
+ * @return The Geometry for NPatch
+ */
+ Geometry GetNPatchGeometry(int index);
+
+ /**
+ * @brief Gets the Npatch Shader object
+ *
+ * @param[in] index The index of broken image
+ * @return The Shader for NPatch
+ */
+ Shader GetNPatchShader(int index);
+
+ /**
+ * @brief Returns a broken image type
+ * @param[in] index BrokenImage index
+ * @return The broken image type.
+ */
+ VisualUrl::Type GetBrokenImageVisualType(int index);
+
+private:
+ struct BrokenImageInfo
+ {
+ BrokenImageInfo()
+ :visualType(),
+ url(""),
+ npatchId(NPatchData::INVALID_NPATCH_DATA_ID),
+ texture(),
+ width(0),
+ height(0)
+ {
+ }
+
+ ~BrokenImageInfo()
+ {
+ }
+
+ // Data
+ VisualUrl::Type visualType;
+ std::string url;
+ NPatchData::NPatchDataId npatchId;
+ Texture texture;
+ uint32_t width;
+ uint32_t height;
+ };
+
Geometry mGeometry[GEOMETRY_TYPE_MAX + 1];
Shader mShader[SHADER_TYPE_MAX + 1];
ImageAtlasManagerPtr mAtlasManager;
TextureManager mTextureManager;
NPatchLoader mNPatchLoader;
- Texture mBrokenImageTexture;
+
SvgRasterizeThread* mSvgRasterizeThread;
std::unique_ptr<VectorAnimationManager> mVectorAnimationManager;
- std::string mBrokenImageUrl;
bool mPreMultiplyOnLoad;
+ std::vector<BrokenImageInfo> mBrokenImageInfoContainer;
+ std::string mDefaultBrokenImageUrl;
+ bool mUseDefaultBrokenImageOnly;
};
} // namespace Internal