(TextAtlas) Let Text relative geometry use uint32_t indices 04/319504/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 12 Feb 2025 04:15:12 +0000 (13:15 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 12 Feb 2025 04:15:12 +0000 (13:15 +0900)
Due to the data format is uint16_t type, we cannot render well
if the length of text is bigger than 16384.
If we add underline or strokethrough, the number of text limitation
also be reduced.

To fix this issue, let we make indices what TextAtlas geometry use
uint32_t type, instead uint16_t type.

Since we support uint32_t* indices now a day, it will be okay.

Change-Id: I887d78bb5f7123580fc7d6d5b68e35a7d2fdd954
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-toolkit/internal/text/controller/text-controller-background-actor.cpp
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/rendering/atlas/atlas-manager.h
dali-toolkit/internal/text/rendering/atlas/atlas-mesh-factory.cpp
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/internal/text/rendering/vector-based/vector-based-renderer.cpp

index f37c9c7e0a525a9969fe5858075cdef39c515a1d..bd5dada47318c2f493feec531ab13b91547f9f17 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -41,7 +41,7 @@ struct BackgroundVertex
 struct BackgroundMesh
 {
   Vector<BackgroundVertex> mVertices; ///< container of vertices
-  Vector<unsigned short>   mIndices;  ///< container of indices
+  Vector<uint32_t>         mIndices;  ///< container of indices
 };
 } // unnamed namespace
 
index 9f807dfc972ef6d06d4e0ce57a02fd425a9007f5..e61e42eeaa8031c55a5ec806befbd67cb0a65f5d 100644 (file)
@@ -1219,8 +1219,8 @@ struct Decorator::Impl : public ConnectionTracker
         const float offsetX = mHighlightPosition.x + 0.5f * mHighlightSize.width;
         const float offsetY = mHighlightPosition.y + 0.5f * mHighlightSize.height;
 
-        Vector<Vector2>        vertices;
-        Vector<unsigned short> indices;
+        Vector<Vector2>  vertices;
+        Vector<uint32_t> indices;
 
         vertices.Reserve(4u * numberOfQuads);
         indices.Reserve(6u * numberOfQuads);
index dcbcf273900db7bb427b4668fb10f8e30901d010..d8ff4e484c40e246060f707d3ad0b5ccc11ba9b2 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_ATLAS_MANAGER_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -85,8 +85,8 @@ public:
 
   struct Mesh2D
   {
-    Vector<Vertex2D>       mVertices; ///< container of vertices
-    Vector<unsigned short> mIndices;  ///< container of indices
+    Vector<Vertex2D> mVertices; ///< container of vertices
+    Vector<uint32_t> mIndices;  ///< container of indices
   };
 
   /**
index ac1c9bc1af0ac73991678d955b058f4717e97a7c..63ab2dd99e1294ad649ac3c3f3198ccea6c4fb1f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -147,8 +147,8 @@ void AppendMesh(Toolkit::AtlasManager::Mesh2D&       first,
                         second.mIndices.Begin(),
                         second.mIndices.End());
 
-  for(Vector<unsigned short>::Iterator it    = first.mIndices.Begin() + indicesCount,
-                                       endIt = first.mIndices.End();
+  for(Vector<uint32_t>::Iterator it    = first.mIndices.Begin() + indicesCount,
+                                 endIt = first.mIndices.End();
       it != endIt;
       ++it)
   {
index 91cee528f693f510d668d4766869e2fdcd81525c..afd00f3b1d560d884b7c4ba284bf6516f7e8c7c2 100644 (file)
@@ -1097,7 +1097,6 @@ struct AtlasRenderer::Impl
                           const UnderlineStyleProperties&                     viewUnderlineProperties,
                           const std::map<uint32_t, UnderlineStyleProperties>& mapUnderlineChunkIdWithProperties)
   {
-
     for(Vector<Extent>::ConstIterator eIt    = extents.Begin(),
                                       eEndIt = extents.End();
         eIt != eEndIt;
@@ -1128,7 +1127,7 @@ struct AtlasRenderer::Impl
       float brx         = eIt->mRight;
 
       AtlasManager::Mesh2D newMesh;
-      unsigned short       faceIndex = 0;
+      uint32_t             faceIndex = 0;
 
       if(underlineType == Text::Underline::Type::DASHED)
       {
@@ -1300,7 +1299,7 @@ struct AtlasRenderer::Impl
       float strikethroughPosition = eIt->mLinePosition;
 
       AtlasManager::Mesh2D newMesh;
-      unsigned short       faceIndex = 0;
+      uint32_t             faceIndex = 0;
 
       vert.mPosition.x  = tlx;
       vert.mPosition.y  = strikethroughPosition;
index 76f8c85063bae859b262de1ad5f95fb9e729398e..6ffa82dcb4fd1ccd578128d5f12db2e6ce2f6bff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 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.
@@ -63,7 +63,7 @@ void AddVertex(Vector<Vertex2D>& vertices, float x, float y, float u, float v, c
   vertices.PushBack(meshVertex);
 }
 
-void AddTriangle(Vector<unsigned short>& indices, unsigned int v0, unsigned int v1, unsigned int v2)
+void AddTriangle(Vector<uint32_t>& indices, uint32_t v0, uint32_t v1, uint32_t v2)
 {
   indices.PushBack(v0);
   indices.PushBack(v1);
@@ -78,7 +78,7 @@ bool CreateGeometry(const Vector<GlyphInfo>&           glyphs,
                     VectorBlobAtlas&                   atlas,
                     Dali::TextAbstraction::FontClient& fontClient,
                     Vector<Vertex2D>&                  vertices,
-                    Vector<unsigned short>&            indices,
+                    Vector<uint32_t>&                  indices,
                     const Vector4* const               colorsBuffer,
                     const ColorIndex* const            colorIndicesBuffer,
                     const Vector4&                     defaultColor)
@@ -88,7 +88,7 @@ bool CreateGeometry(const Vector<GlyphInfo>&           glyphs,
 
   bool atlasFull(false);
 
-  for(unsigned int i = 0, idx = 0; i < numberOfGlyphs && !atlasFull; ++i)
+  for(uint32_t i = 0u, idx = 0u; i < numberOfGlyphs && !atlasFull; ++i)
   {
     if(glyphs[i].width > 0 &&
        glyphs[i].height > 0)
@@ -219,8 +219,8 @@ Actor VectorBasedRenderer::Render(Text::ViewInterface& view,
     const ColorIndex* const colorIndicesBuffer = view.GetColorIndices();
     const Vector4&          defaultColor       = view.GetTextColor();
 
-    Vector<Vertex2D>       vertices;
-    Vector<unsigned short> indices;
+    Vector<Vertex2D> vertices;
+    Vector<uint32_t> indices;
 
     const Vector2& controlSize = view.GetControlSize();
     float          xOffset     = -alignmentOffset + controlSize.width * -0.5f;