[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / text / text-visual.h
index c81fbce..7be059c 100644 (file)
@@ -2,7 +2,7 @@
 #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.
@@ -194,47 +194,31 @@ protected:
 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);
-      }
     }
   };
 
@@ -260,21 +244,21 @@ private:
   /**
    * @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.
@@ -331,6 +315,7 @@ private:
   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.