#define DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H
/*
- * Copyright (c) 2022 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.
#include <dali/public-api/rendering/visual-renderer.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/controller/text-controller.h>
#include <dali-toolkit/internal/text/rendering/text-typesetter.h>
-#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/visuals/text-visual-shader-factory.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
private:
struct TilingInfo
{
- unsigned char* textBuffer;
- unsigned char* styleBuffer;
- unsigned char* overlayStyleBuffer;
- unsigned char* maskBuffer;
- int width;
- int height;
- Pixel::Format textPixelFormat;
- int offsetPosition;
- Vector2 offSet;
-
- TilingInfo(int width, int height, Pixel::Format textPixelFormat)
- : textBuffer(NULL),
- styleBuffer(NULL),
- overlayStyleBuffer(NULL),
- maskBuffer(NULL),
+ PixelData textPixelData;
+ PixelData stylePixelData;
+ PixelData overlayStylePixelData;
+ PixelData maskPixelData;
+ int32_t width;
+ int32_t height;
+ Pixel::Format textPixelFormat;
+ uint32_t offsetHeight;
+ Vector2 transformOffset;
+
+ TilingInfo(int32_t width, int32_t height, Pixel::Format textPixelFormat)
+ : textPixelData(),
+ stylePixelData(),
+ overlayStylePixelData(),
+ maskPixelData(),
width(width),
height(height),
textPixelFormat(textPixelFormat),
- offsetPosition(0),
- offSet(0.f, 0.f)
+ offsetHeight(0u),
+ transformOffset(0.f, 0.f)
{
}
~TilingInfo()
{
- if(textBuffer)
- {
- free(textBuffer);
- }
- if(styleBuffer)
- {
- free(styleBuffer);
- }
- if(overlayStyleBuffer)
- {
- free(overlayStyleBuffer);
- }
- if(maskBuffer)
- {
- free(maskBuffer);
- }
}
};
/**
* @brief Create a texture in textureSet and add it.
* @param[in] textureSet The textureSet to which the texture will be added.
- * @param[in] data The PixelData to be uploaded to texture
+ * @param[in] data The PixelData to be uploaded to texture.
* @param[in] sampler The sampler.
* @param[in] textureSetIndex The Index of TextureSet.
*/
void AddTexture(TextureSet& textureSet, PixelData& data, Sampler& sampler, unsigned int textureSetIndex);
/**
- * @brief Convert the buffer to pixelData.
- * @param[in] buffer The Buffer to be converted to pixelData.
- * @param[in] width The width of pixel data.
- * @param[in] height The height of pixel data.
- * @param[in] offsetPosition The The buffer's start position.
- * @param[in] textPixelFormat The PixelForma of text.
+ * @brief Create a texture in textureSet and add it.
+ * @param[in] textureSet The textureSet to which the texture will be added.
+ * @param[in] tilingInfo The tiling infomation to be uploaded to texture.
+ * @param[in] data The PixelData to be uploaded to texture.
+ * @param[in] sampler The sampler.
+ * @param[in] textureSetIndex The Index of TextureSet.
*/
- PixelData ConvertToPixelData(unsigned char* buffer, int width, int height, int offsetPosition, const Pixel::Format textPixelFormat);
+ void AddTilingTexture(TextureSet& textureSet, TilingInfo& tilingInfo, PixelData& data, Sampler& sampler, unsigned int textureSetIndex);
/**
* @brief Create the text's texture. It will use cached shader feature for text visual.
WeakHandle<Actor> mControl; ///< The control where the renderer is added.
Constraint mColorConstraint{}; ///< Color constraint
Constraint mOpacityConstraint{}; ///< Opacity constraint
+ Property::Index mHasMultipleTextColorsIndex; ///< The index of uHasMultipleTextColors proeprty.
Property::Index mAnimatableTextColorPropertyIndex; ///< The index of animatable text color property registered by the control.
Property::Index mTextColorAnimatableIndex; ///< The index of uTextColorAnimatable property.
bool mRendererUpdateNeeded : 1; ///< The flag to indicate whether the renderer needs to be updated.