TextModel - Update the color runs. 93/66393/9
authorVictor Cebollada <v.cebollada@samsung.com>
Mon, 18 Apr 2016 08:23:51 +0000 (09:23 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Mon, 25 Apr 2016 09:43:01 +0000 (10:43 +0100)
Change-Id: If392f542fb3ce75532e125c805968fcc76b475cb
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
17 files changed:
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-model.cpp
dali-toolkit/internal/text/color-run.h
dali-toolkit/internal/text/color-segmentation.cpp
dali-toolkit/internal/text/color-segmentation.h
dali-toolkit/internal/text/input-style.h
dali-toolkit/internal/text/logical-model-impl.cpp
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/internal/text/rendering/vector-based/glyphy-shader/glyphy-shader.cpp
dali-toolkit/internal/text/rendering/vector-based/vector-based-renderer.cpp
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-definitions.h
dali-toolkit/internal/text/text-view-interface.h
dali-toolkit/internal/text/text-view.cpp
dali-toolkit/internal/text/text-view.h
dali-toolkit/internal/text/visual-model-impl.h

index 4ec0eba..4bba1f9 100644 (file)
@@ -90,7 +90,6 @@ void ClearModelData( CharacterIndex characterIndex,
   visualModel->mGlyphsPerCharacter.Clear();
   visualModel->mGlyphPositions.Clear();
   visualModel->mLines.Clear();
-  visualModel->mColorRuns.Clear();
 
   visualModel->ClearCaches();
 }
index 860ec7b..73a9a1c 100644 (file)
@@ -43,12 +43,6 @@ struct ColorRun
   Vector4      color;        ///< The color of the characters.
 };
 
-struct ColorGlyphRun
-{
-  GlyphRun glyphRun; ///< The initial glyph index and the number of glyphs of the run.
-  Vector4  color;    ///< The color of the glyphs.
-};
-
 } // namespace Text
 
 } // namespace Toolkit
index 9169225..f0d6838 100644 (file)
@@ -33,52 +33,103 @@ namespace Toolkit
 namespace Text
 {
 
-void SetColorSegmentationInfo( const Vector<ColorRun>& characterColorRuns,
+/**
+ * @brief Finds a color in the vector of colors.
+ *        It inserts the color in the vector if it's not in.
+ *
+ * @param[in,out] colors The vector of colors.
+ * @param[in] color The color to find.
+ *
+ * @return The index where the color is in the vector.
+ */
+ColorIndex FindColor( Vector<Vector4>& colors,
+                      const Vector4& color )
+{
+  ColorIndex index = 1u;
+  for( Vector<Vector4>::Iterator it = colors.Begin(),
+         endIt = colors.End();
+       it != endIt;
+       ++it )
+  {
+    if( color == *it )
+    {
+      return index;
+    }
+
+    ++index;
+  }
+
+  colors.PushBack( color );
+
+  return index;
+}
+
+void SetColorSegmentationInfo( const Vector<ColorRun>& colorRuns,
                                const Vector<GlyphIndex>& charactersToGlyph,
                                const Vector<Length>& glyphsPerCharacter,
-                               Vector<ColorGlyphRun>& glyphColorRuns )
+                               CharacterIndex startCharacterIndex,
+                               GlyphIndex startGlyphIndex,
+                               Length numberOfCharacters,
+                               Vector<Vector4>& colors,
+                               Vector<ColorIndex>& colorIndices )
 {
-  const VectorBase::SizeType numberOfColorRuns = characterColorRuns.Count();
-
-  if( 0u == numberOfColorRuns )
+  if( 0u == charactersToGlyph.Count() )
   {
-    // Nothing to do.
+    // Nothing to do if there is no text.
     return;
   }
 
-  // Resize the color runs for the glyphs.
-  glyphColorRuns.Resize( numberOfColorRuns );
-
   // Get pointers to the buffers.
-  ColorGlyphRun* glyphColorRunsBuffer = glyphColorRuns.Begin();
   const GlyphIndex* const charactersToGlyphBuffer = charactersToGlyph.Begin();
   const Length* const glyphsPerCharacterBuffer = glyphsPerCharacter.Begin();
 
+  // Calculate the number of glyphs to insert.
+  const CharacterIndex lastCharacterIndex = startCharacterIndex + numberOfCharacters - 1u;
+  const Length numberOfNewGlyphs = *( charactersToGlyphBuffer + lastCharacterIndex ) + *( glyphsPerCharacterBuffer + lastCharacterIndex ) - *( charactersToGlyphBuffer + startCharacterIndex );
+
+  // Reserve space for the new color indices.
+  Vector<ColorIndex> newColorIndices;
+  newColorIndices.Resize( numberOfNewGlyphs );
+
+  ColorIndex* newColorIndicesBuffer = newColorIndices.Begin();
+
   // Convert from characters to glyphs.
   Length index = 0u;
-  for( Vector<ColorRun>::ConstIterator it = characterColorRuns.Begin(),
-         endIt = characterColorRuns.End();
+  for( Vector<ColorRun>::ConstIterator it = colorRuns.Begin(),
+         endIt = colorRuns.End();
        it != endIt;
        ++it, ++index )
   {
     const ColorRun& colorRun = *it;
 
-    if( 0u < colorRun.characterRun.numberOfCharacters )
+    if( ( startCharacterIndex < colorRun.characterRun.characterIndex + colorRun.characterRun.numberOfCharacters ) &&
+        ( colorRun.characterRun.characterIndex < startCharacterIndex + numberOfCharacters ) )
     {
-      // Get the next color glyph run.
-      ColorGlyphRun& colorGlyphRun = *( glyphColorRunsBuffer + index );
-      colorGlyphRun.color = colorRun.color;
-
-      // Convert the color run index from character to glyph.
-      colorGlyphRun.glyphRun.glyphIndex = *( charactersToGlyphBuffer + colorRun.characterRun.characterIndex );
-
-      // Get the index to the last character of the run.
-      const CharacterIndex lastIndex = colorRun.characterRun.characterIndex + colorRun.characterRun.numberOfCharacters - 1u;
-
-      // Calculate the number of glyphs.
-      colorGlyphRun.glyphRun.numberOfGlyphs = *( charactersToGlyphBuffer + lastIndex ) + *( glyphsPerCharacterBuffer + lastIndex ) - colorGlyphRun.glyphRun.glyphIndex;
+      if( 0u < colorRun.characterRun.numberOfCharacters )
+      {
+        // Find the color index.
+        const ColorIndex colorIndex = FindColor( colors, colorRun.color );
+
+        // Get the index to the last character of the run.
+        const CharacterIndex lastIndex = colorRun.characterRun.characterIndex + colorRun.characterRun.numberOfCharacters - 1u;
+
+        const GlyphIndex glyphIndex = std::max( startGlyphIndex, *( charactersToGlyphBuffer + colorRun.characterRun.characterIndex ) ) - startGlyphIndex;
+        // Get the number of glyphs of the run.
+        const Length lastGlyphIndexPlusOne = std::min( numberOfNewGlyphs, *( charactersToGlyphBuffer + lastIndex ) + *( glyphsPerCharacterBuffer + lastIndex ) - startGlyphIndex );
+
+        // Set the indices.
+        for( GlyphIndex i = glyphIndex; i < lastGlyphIndexPlusOne; ++i )
+        {
+          *( newColorIndicesBuffer + i ) = colorIndex;
+        }
+      }
     }
   }
+
+  // Insert the new indices.
+  colorIndices.Insert( colorIndices.Begin() + startGlyphIndex,
+                       newColorIndices.Begin(),
+                       newColorIndices.End() );
 }
 
 } // namespace Text
index 9e52de1..0a816ab 100644 (file)
@@ -38,15 +38,23 @@ class LogicalModel;
 /**
  * @brief Creates color glyph runs.
  *
- * @param[in] characterColorRuns The color runs in characters (set in the mark-up string).
+ * @param[in] colorRuns The color runs in characters (set in the mark-up string).
  * @param[in] charactersToGlyph Conversion table from characters to glyphs.
  * @param[in] glyphsPerCharacter Table with the number of glyphs for each character.
- * @param[out] glyphColorRuns The color runs in glyphs.
+ * @param[in] startCharacterIndex The character from where the text is shaped.
+ * @param[in] startGlyphIndex The glyph from where the text is shaped.
+ * @param[in] numberOfCharacters The number of characters to be shaped.
+ * @param[out] colors The vector of colors.
+ * @param[out] colorIndices Indices to the vector of colors.
  */
-void SetColorSegmentationInfo( const Vector<ColorRun>& characterColorRuns,
+void SetColorSegmentationInfo( const Vector<ColorRun>& colorRuns,
                                const Vector<GlyphIndex>& charactersToGlyph,
                                const Vector<Length>& glyphsPerCharacter,
-                               Vector<ColorGlyphRun>& glyphColorRuns );
+                               CharacterIndex startCharacterIndex,
+                               GlyphIndex startGlyphIndex,
+                               Length numberOfCharacters,
+                               Vector<Vector4>& colors,
+                               Vector<ColorIndex>& colorIndices );
 
 } // namespace Text
 
index a9e6eab..5d7aead 100644 (file)
@@ -46,6 +46,7 @@ struct InputStyle
     width( TextAbstraction::FontWidth::NORMAL ),
     slant( TextAbstraction::FontSlant::NORMAL ),
     size( 0.f ),
+    isDefaultColor( true ),
     familyDefined( false ),
     weightDefined( false ),
     widthDefined( false ),
@@ -64,11 +65,12 @@ struct InputStyle
   FontSlant   slant;      ///< The font's slant.
   float       size;       ///< The font's size.
 
-  bool        familyDefined : 1; ///< Whether the font's family is defined.
-  bool        weightDefined : 1; ///< Whether the font's weight is defined.
-  bool        widthDefined  : 1; ///< Whether the font's width is defined.
-  bool        slantDefined  : 1; ///< Whether the font's slant is defined.
-  bool        sizeDefined   : 1; ///< Whether the font's size is defined.
+  bool        isDefaultColor : 1; ///< Whether the text's color is the default.
+  bool        familyDefined  : 1; ///< Whether the font's family is defined.
+  bool        weightDefined  : 1; ///< Whether the font's weight is defined.
+  bool        widthDefined   : 1; ///< Whether the font's width is defined.
+  bool        slantDefined   : 1; ///< Whether the font's slant is defined.
+  bool        sizeDefined    : 1; ///< Whether the font's size is defined.
 };
 
 } // namespace Text
index 239a2f8..c61e004 100644 (file)
@@ -307,6 +307,7 @@ void LogicalModel::RetrieveStyle( CharacterIndex index, InputStyle& style )
   if( colorOverriden )
   {
     style.textColor = ( *( colorRunsBuffer + colorIndex ) ).color;
+    style.isDefaultColor = false;
   }
 
   // Reset the run index.
@@ -410,9 +411,6 @@ void LogicalModel::RetrieveStyle( CharacterIndex index, InputStyle& style )
     style.size = static_cast<float>( fontDescriptionRun.size ) / 64.f;
     style.sizeDefined = true;
   }
-
-  // Reset the run index.
-  runIndex = 0u;
 }
 
 void LogicalModel::ClearFontDescriptionRuns()
index 7a76534..3755fcf 100644 (file)
@@ -166,7 +166,9 @@ struct AtlasRenderer::Impl
   void AddGlyphs( Text::ViewInterface& view,
                   const Vector<Vector2>& positions,
                   const Vector<GlyphInfo>& glyphs,
-                  const Vector<Vector4>& colors,
+                  const Vector4& defaultColor,
+                  const Vector4* const colorsBuffer,
+                  const ColorIndex* const colorIndicesBuffer,
                   int depth )
   {
     AtlasManager::AtlasSlot slot;
@@ -184,6 +186,8 @@ struct AtlasRenderer::Impl
     const Vector4& underlineColor( view.GetUnderlineColor() );
     const float underlineHeight( view.GetUnderlineHeight() );
 
+    const bool useDefaultColor = ( NULL == colorsBuffer );
+
     // Get the underline runs.
     const Length numberOfUnderlineRuns = view.GetNumberOfUnderlineRuns();
     Vector<GlyphRun> underlineRuns;
@@ -212,7 +216,6 @@ struct AtlasRenderer::Impl
     Vector< TextCacheEntry > newTextCache;
     const GlyphInfo* const glyphsBuffer = glyphs.Begin();
     const Vector2* const positionsBuffer = positions.Begin();
-    const Vector4* const colorsBuffer = colors.Begin();
 
     for( uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i )
     {
@@ -352,7 +355,8 @@ struct AtlasRenderer::Impl
         }
 
         // Get the color of the character.
-        const Vector4& color = *( colorsBuffer + i );
+        const ColorIndex colorIndex = useDefaultColor ? 0u : *( colorIndicesBuffer + i );
+        const Vector4& color = ( useDefaultColor || ( 0u == colorIndex ) ) ? defaultColor : *( colorsBuffer + colorIndex - 1u );
 
         for( unsigned int index = 0u, size = newMesh.mVertices.Count();
              index < size;
@@ -750,23 +754,24 @@ Actor AtlasRenderer::Render( Text::ViewInterface& view, int depth )
     Vector<Vector2> positions;
     positions.Resize( numberOfGlyphs );
 
-    Vector<Vector4> colors;
-    colors.Resize( numberOfGlyphs, view.GetTextColor() );
-
     numberOfGlyphs = view.GetGlyphs( glyphs.Begin(),
                                      positions.Begin(),
-                                     colors.Begin(),
                                      0u,
                                      numberOfGlyphs );
 
     glyphs.Resize( numberOfGlyphs );
     positions.Resize( numberOfGlyphs );
-    colors.Resize( numberOfGlyphs );
+
+    const Vector4* const colorsBuffer = view.GetColors();
+    const ColorIndex* const colorIndicesBuffer = view.GetColorIndices();
+    const Vector4& defaultColor = view.GetTextColor();
 
     mImpl->AddGlyphs( view,
                       positions,
                       glyphs,
-                      colors,
+                      defaultColor,
+                      colorsBuffer,
+                      colorIndicesBuffer,
                       depth );
 
     /* In the case where AddGlyphs does not create a renderable Actor for example when glyphs are all whitespace create a new Actor. */
index 53db8fb..556a902 100644 (file)
@@ -48,6 +48,8 @@ const char* const VERTEX_SHADER_MAIN =
 "varying   mediump vec3    vNormal;\n"
 "attribute mediump vec2    aPosition;\n"
 "varying   mediump vec4    vVertex;\n"
+"attribute mediump vec4    aColor;\n"
+"varying   mediump vec4    vColor;\n"
 "varying vec4 v_glyph;\n"
 "\n"
 "vec4\n"
@@ -65,6 +67,7 @@ const char* const VERTEX_SHADER_MAIN =
 "{\n"
 "  gl_Position = uMvpMatrix * vec4 (aPosition, 0.0, 1.0);\n"
 "  v_glyph = glyph_vertex_transcode (aTexCoord);\n"
+"  vColor = aColor;\n"
 "}\n"
 ;
 
@@ -87,6 +90,7 @@ const char* const FRAGMENT_SHADER_PREFIX =
 "uniform lowp  vec4    uColor;\n"
 "varying highp vec4    vVertex;\n"
 "varying highp vec3    vNormal;\n"
+"varying mediump vec4  vColor;\n"
 "uniform vec4 u_atlas_info;\n"
 "\n"
 "#define GLYPHY_TEXTURE1D_EXTRA_DECLS , sampler2D _tex, ivec4 _atlas_info, ivec2 _atlas_pos\n"
@@ -157,7 +161,7 @@ static const char* FRAGMENT_SHADER_MAIN =
 "  vec2 dpdy = dFdy (p);\n"
 "  float m = length (vec2 (length (dpdx), length (dpdy))) * SQRT2_2;\n"
 "\n"
-"  vec4 color = uColor;\n"
+"  vec4 color = vec4( vColor.rgb * uColor.rgb, vColor.a * uColor.a );\n"
 "\n"
 "  ivec4 uu_atlas_info = ivec4( u_atlas_info );"
 "  float gsdist = glyphy_sdf (p, gi.nominal_size GLYPHY_DEMO_EXTRA_ARGS);\n"
index 816a45d..82bf555 100644 (file)
@@ -50,15 +50,17 @@ struct Vertex2D
   float y;
   float u;
   float v;
+  Vector4 color;
 };
 
-void AddVertex( Vector<Vertex2D>& vertices, float x, float y, float u, float v )
+void AddVertex( Vector<Vertex2D>& vertices, float x, float y, float u, float v, const Vector4& color )
 {
   Vertex2D meshVertex;
   meshVertex.x = x;
   meshVertex.y = y;
   meshVertex.u = u;
   meshVertex.v = v;
+  meshVertex.color = color;
   vertices.PushBack( meshVertex );
 }
 
@@ -77,8 +79,14 @@ bool CreateGeometry( const Vector<GlyphInfo>& glyphs,
                      VectorBlobAtlas& atlas,
                      Dali::TextAbstraction::FontClient& fontClient,
                      Vector< Vertex2D >& vertices,
-                     Vector< unsigned int >& indices )
+                     Vector< unsigned int >& indices,
+                     const Vector4* const colorsBuffer,
+                     const ColorIndex* const colorIndicesBuffer,
+                     const Vector4& defaultColor )
 {
+  // Whether the default color is used.
+  const bool useDefaultColor = ( NULL == colorsBuffer );
+
   bool atlasFull( false );
 
   for( unsigned int i=0, idx=0; i<numberOfGlyphs && !atlasFull; ++i )
@@ -114,20 +122,24 @@ bool CreateGeometry( const Vector<GlyphInfo>& glyphs,
 
       if( foundBlob )
       {
+        // Get the color of the character.
+        const ColorIndex colorIndex = useDefaultColor ? 0u : *( colorIndicesBuffer + i );
+        const Vector4& color = ( useDefaultColor || ( 0u == colorIndex ) ) ? defaultColor : *( colorsBuffer + colorIndex - 1u );
+
         const float x1( xOffset + positions[i].x );
         const float x2( xOffset + positions[i].x + glyphs[i].width );
         const float y1( yOffset + positions[i].y );
         const float y2( yOffset + positions[i].y + glyphs[i].height );
 
-        AddVertex( vertices, x1, y2, blobCoords[0].u, blobCoords[0].v );
-        AddVertex( vertices, x1, y1, blobCoords[1].u, blobCoords[1].v );
-        AddVertex( vertices, x2, y2, blobCoords[2].u, blobCoords[2].v );
+        AddVertex( vertices, x1, y2, blobCoords[0].u, blobCoords[0].v, color );
+        AddVertex( vertices, x1, y1, blobCoords[1].u, blobCoords[1].v, color );
+        AddVertex( vertices, x2, y2, blobCoords[2].u, blobCoords[2].v, color );
         AddTriangle( indices, idx, idx+1, idx+2 );
         idx+=3;
 
-        AddVertex( vertices, x1, y1, blobCoords[1].u, blobCoords[1].v );
-        AddVertex( vertices, x2, y2, blobCoords[2].u, blobCoords[2].v );
-        AddVertex( vertices, x2, y1, blobCoords[3].u, blobCoords[3].v );
+        AddVertex( vertices, x1, y1, blobCoords[1].u, blobCoords[1].v, color );
+        AddVertex( vertices, x2, y2, blobCoords[2].u, blobCoords[2].v, color );
+        AddVertex( vertices, x2, y1, blobCoords[3].u, blobCoords[3].v, color );
         AddTriangle( indices, idx, idx+1, idx+2 );
         idx+=3;
       }
@@ -148,6 +160,7 @@ struct VectorBasedRenderer::Impl
 
     mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
     mQuadVertexFormat[ "aTexCoord" ] = Property::VECTOR2;
+    mQuadVertexFormat[ "aColor" ] = Property::VECTOR4;
     mQuadIndexFormat[ "indices" ] = Property::INTEGER;
   }
 
@@ -177,7 +190,7 @@ Actor VectorBasedRenderer::Render( Text::ViewInterface& view, int /*depth*/ )
   mImpl->mActor = Actor::New();
   mImpl->mActor.SetParentOrigin( ParentOrigin::CENTER );
   mImpl->mActor.SetSize( view.GetControlSize() );
-  mImpl->mActor.SetColor( Color::BLACK );
+  mImpl->mActor.SetColor( Color::WHITE );
 #if defined(DEBUG_ENABLED)
   mImpl->mActor.SetName( "Text renderable actor" );
 #endif
@@ -192,17 +205,17 @@ Actor VectorBasedRenderer::Render( Text::ViewInterface& view, int /*depth*/ )
     Vector<Vector2> positions;
     positions.Resize( numberOfGlyphs );
 
-    Vector<Vector4> colors;
-    colors.Resize( numberOfGlyphs, view.GetTextColor() );
-
     numberOfGlyphs = view.GetGlyphs( glyphs.Begin(),
                                      positions.Begin(),
-                                     colors.Begin(),
                                      0u,
                                      numberOfGlyphs );
     glyphs.Resize( numberOfGlyphs );
     positions.Resize( numberOfGlyphs );
 
+    const Vector4* const colorsBuffer = view.GetColors();
+    const ColorIndex* const colorIndicesBuffer = view.GetColorIndices();
+    const Vector4& defaultColor = view.GetTextColor();
+
     Vector< Vertex2D > vertices;
     Vector< unsigned int > indices;
 
@@ -218,7 +231,18 @@ Actor VectorBasedRenderer::Render( Text::ViewInterface& view, int /*depth*/ )
     }
 
     // First try adding the glyphs to the previous shared atlas
-    bool allGlyphsAdded = CreateGeometry( glyphs, numberOfGlyphs, positions, xOffset, yOffset, *mImpl->mAtlas, mImpl->mFontClient, vertices, indices );
+    bool allGlyphsAdded = CreateGeometry( glyphs,
+                                          numberOfGlyphs,
+                                          positions,
+                                          xOffset,
+                                          yOffset,
+                                          *mImpl->mAtlas,
+                                          mImpl->mFontClient,
+                                          vertices,
+                                          indices,
+                                          colorsBuffer,
+                                          colorIndicesBuffer,
+                                          defaultColor );
 
     if( ! allGlyphsAdded )
     {
@@ -230,7 +254,18 @@ Actor VectorBasedRenderer::Render( Text::ViewInterface& view, int /*depth*/ )
       VectorBlobAtlasShare atlasShare = VectorBlobAtlasShare::Get();
       mImpl->mAtlas = atlasShare.GetNewAtlas();
 
-      CreateGeometry( glyphs, numberOfGlyphs, positions, xOffset, yOffset, *mImpl->mAtlas, mImpl->mFontClient, vertices, indices );
+      CreateGeometry( glyphs,
+                      numberOfGlyphs,
+                      positions,
+                      xOffset,
+                      yOffset,
+                      *mImpl->mAtlas,
+                      mImpl->mFontClient,
+                      vertices,
+                      indices,
+                      colorsBuffer,
+                      colorIndicesBuffer,
+                      defaultColor );
       // Return value ignored; using more than an entire new atlas is not supported
     }
 
index f64c266..95266cd 100644 (file)
@@ -338,6 +338,7 @@ void Controller::Impl::CalculateTextUpdateIndices( Length& numberOfCharacters )
       numberOfCharacters = lastParagraph.characterRun.characterIndex + lastParagraph.characterRun.numberOfCharacters - mTextUpdateInfo.mParagraphCharacterIndex;
     }
   }
+
   mTextUpdateInfo.mRequestedNumberOfCharacters = numberOfCharacters + mTextUpdateInfo.mNumberOfCharactersToAdd - mTextUpdateInfo.mNumberOfCharactersToRemove;
   mTextUpdateInfo.mStartGlyphIndex = *( mVisualModel->mCharactersToGlyph.Begin() + mTextUpdateInfo.mParagraphCharacterIndex );
 }
@@ -407,6 +408,11 @@ void Controller::Impl::ClearFullModelData( OperationsMask operations )
   {
     mVisualModel->mLines.Clear();
   }
+
+  if( COLOR & operations )
+  {
+    mVisualModel->mColorIndices.Clear();
+  }
 }
 
 void Controller::Impl::ClearCharacterModelData( CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations )
@@ -512,97 +518,100 @@ void Controller::Impl::ClearGlyphModelData( CharacterIndex startIndex, Character
   const CharacterIndex endIndexPlusOne = endIndex + 1u;
   const Length numberOfCharactersRemoved = endIndexPlusOne - startIndex;
 
-  const bool clearShape = SHAPE_TEXT & operations;
-  const bool clearLayout = LAYOUT & operations;
+  // Convert the character index to glyph index before deleting the character to glyph and the glyphs per character buffers.
+  GlyphIndex* charactersToGlyphBuffer = mVisualModel->mCharactersToGlyph.Begin();
+  Length* glyphsPerCharacterBuffer = mVisualModel->mGlyphsPerCharacter.Begin();
 
-  if( clearShape || clearLayout )
-  {
-    // Convert the character index to glyph index before deleting the character to glyph and the glyphs per character buffers.
-    GlyphIndex* charactersToGlyphBuffer = mVisualModel->mCharactersToGlyph.Begin();
-    Length* glyphsPerCharacterBuffer = mVisualModel->mGlyphsPerCharacter.Begin();
+  const GlyphIndex endGlyphIndexPlusOne = *( charactersToGlyphBuffer + endIndex ) + *( glyphsPerCharacterBuffer + endIndex );
+  const Length numberOfGlyphsRemoved = endGlyphIndexPlusOne - mTextUpdateInfo.mStartGlyphIndex;
 
-    const GlyphIndex endGlyphIndex = *( charactersToGlyphBuffer + endIndex );
-    const GlyphIndex endGlyphIndexPlusOne = endGlyphIndex + *( glyphsPerCharacterBuffer + endIndex );
-    const Length numberOfGlyphsRemoved = endGlyphIndexPlusOne - mTextUpdateInfo.mStartGlyphIndex;
-
-    if( clearShape )
+  if( SHAPE_TEXT & operations )
+  {
+    // Update the character to glyph indices.
+    for( Vector<GlyphIndex>::Iterator it =  charactersToGlyphBuffer + endIndexPlusOne,
+           endIt =  charactersToGlyphBuffer + mVisualModel->mCharactersToGlyph.Count();
+         it != endIt;
+         ++it )
     {
-      // Update the character to glyph indices.
-      for( Vector<GlyphIndex>::Iterator it =  charactersToGlyphBuffer + endIndexPlusOne,
-             endIt =  charactersToGlyphBuffer + mVisualModel->mCharactersToGlyph.Count();
-           it != endIt;
-           ++it )
-      {
-        CharacterIndex& index = *it;
-        index -= numberOfGlyphsRemoved;
-      }
+      CharacterIndex& index = *it;
+      index -= numberOfGlyphsRemoved;
+    }
 
-      // Clear the character to glyph conversion table.
-      mVisualModel->mCharactersToGlyph.Erase( charactersToGlyphBuffer + startIndex,
-                                              charactersToGlyphBuffer + endIndexPlusOne );
+    // Clear the character to glyph conversion table.
+    mVisualModel->mCharactersToGlyph.Erase( charactersToGlyphBuffer + startIndex,
+                                            charactersToGlyphBuffer + endIndexPlusOne );
 
-      // Clear the glyphs per character table.
-      mVisualModel->mGlyphsPerCharacter.Erase( glyphsPerCharacterBuffer + startIndex,
-                                               glyphsPerCharacterBuffer + endIndexPlusOne );
+    // Clear the glyphs per character table.
+    mVisualModel->mGlyphsPerCharacter.Erase( glyphsPerCharacterBuffer + startIndex,
+                                             glyphsPerCharacterBuffer + endIndexPlusOne );
 
-      // Clear the glyphs buffer.
-      GlyphInfo* glyphsBuffer = mVisualModel->mGlyphs.Begin();
-      mVisualModel->mGlyphs.Erase( glyphsBuffer + mTextUpdateInfo.mStartGlyphIndex,
-                                   glyphsBuffer + endGlyphIndexPlusOne );
+    // Clear the glyphs buffer.
+    GlyphInfo* glyphsBuffer = mVisualModel->mGlyphs.Begin();
+    mVisualModel->mGlyphs.Erase( glyphsBuffer + mTextUpdateInfo.mStartGlyphIndex,
+                                 glyphsBuffer + endGlyphIndexPlusOne );
 
-      CharacterIndex* glyphsToCharactersBuffer = mVisualModel->mGlyphsToCharacters.Begin();
+    CharacterIndex* glyphsToCharactersBuffer = mVisualModel->mGlyphsToCharacters.Begin();
 
-      // Update the glyph to character indices.
-      for( Vector<CharacterIndex>::Iterator it = glyphsToCharactersBuffer + endGlyphIndexPlusOne,
-             endIt = glyphsToCharactersBuffer + mVisualModel->mGlyphsToCharacters.Count();
-           it != endIt;
-           ++it )
-      {
-        CharacterIndex& index = *it;
-        index -= numberOfCharactersRemoved;
-      }
+    // Update the glyph to character indices.
+    for( Vector<CharacterIndex>::Iterator it = glyphsToCharactersBuffer + endGlyphIndexPlusOne,
+           endIt = glyphsToCharactersBuffer + mVisualModel->mGlyphsToCharacters.Count();
+         it != endIt;
+         ++it )
+    {
+      CharacterIndex& index = *it;
+      index -= numberOfCharactersRemoved;
+    }
 
-      // Clear the glyphs to characters buffer.
-      mVisualModel->mGlyphsToCharacters.Erase( glyphsToCharactersBuffer + mTextUpdateInfo.mStartGlyphIndex,
-                                               glyphsToCharactersBuffer  + endGlyphIndexPlusOne );
+    // Clear the glyphs to characters buffer.
+    mVisualModel->mGlyphsToCharacters.Erase( glyphsToCharactersBuffer + mTextUpdateInfo.mStartGlyphIndex,
+                                             glyphsToCharactersBuffer  + endGlyphIndexPlusOne );
 
-      // Clear the characters per glyph buffer.
-      Length* charactersPerGlyphBuffer = mVisualModel->mCharactersPerGlyph.Begin();
-      mVisualModel->mCharactersPerGlyph.Erase( charactersPerGlyphBuffer + mTextUpdateInfo.mStartGlyphIndex,
-                                               charactersPerGlyphBuffer + endGlyphIndexPlusOne );
+    // Clear the characters per glyph buffer.
+    Length* charactersPerGlyphBuffer = mVisualModel->mCharactersPerGlyph.Begin();
+    mVisualModel->mCharactersPerGlyph.Erase( charactersPerGlyphBuffer + mTextUpdateInfo.mStartGlyphIndex,
+                                             charactersPerGlyphBuffer + endGlyphIndexPlusOne );
 
-      // Clear the positions buffer.
-      Vector2* positionsBuffer = mVisualModel->mGlyphPositions.Begin();
-      mVisualModel->mGlyphPositions.Erase( positionsBuffer + mTextUpdateInfo.mStartGlyphIndex,
-                                           positionsBuffer + endGlyphIndexPlusOne );
-    }
+    // Clear the positions buffer.
+    Vector2* positionsBuffer = mVisualModel->mGlyphPositions.Begin();
+    mVisualModel->mGlyphPositions.Erase( positionsBuffer + mTextUpdateInfo.mStartGlyphIndex,
+                                         positionsBuffer + endGlyphIndexPlusOne );
+  }
 
-    if( clearLayout )
-    {
-      // Clear the lines.
-      uint32_t startRemoveIndex = mVisualModel->mLines.Count();
-      uint32_t endRemoveIndex = startRemoveIndex;
-      ClearCharacterRuns( startIndex,
-                          endIndex,
-                          mVisualModel->mLines,
-                          startRemoveIndex,
-                          endRemoveIndex );
+  if( LAYOUT & operations )
+  {
+    // Clear the lines.
+    uint32_t startRemoveIndex = mVisualModel->mLines.Count();
+    uint32_t endRemoveIndex = startRemoveIndex;
+    ClearCharacterRuns( startIndex,
+                        endIndex,
+                        mVisualModel->mLines,
+                        startRemoveIndex,
+                        endRemoveIndex );
 
-      // Will update the glyph runs.
-      uint32_t startRemoveGlyphIndex = mVisualModel->mLines.Count();
-      uint32_t endRemoveGlyphIndex = startRemoveIndex;
-      ClearGlyphRuns( mTextUpdateInfo.mStartGlyphIndex,
-                      endGlyphIndex,
-                      mVisualModel->mLines,
-                      startRemoveGlyphIndex,
-                      endRemoveGlyphIndex );
+    // Will update the glyph runs.
+    startRemoveIndex = mVisualModel->mLines.Count();
+    endRemoveIndex = startRemoveIndex;
+    ClearGlyphRuns( mTextUpdateInfo.mStartGlyphIndex,
+                    endGlyphIndexPlusOne - 1u,
+                    mVisualModel->mLines,
+                    startRemoveIndex,
+                    endRemoveIndex );
 
-      // Set the line index from where to insert the new laid-out lines.
-      mTextUpdateInfo.mStartLineIndex = startRemoveIndex;
+    // Set the line index from where to insert the new laid-out lines.
+    mTextUpdateInfo.mStartLineIndex = startRemoveIndex;
 
-      LineRun* linesBuffer = mVisualModel->mLines.Begin();
-      mVisualModel->mLines.Erase( linesBuffer + startRemoveIndex,
-                                  linesBuffer + endRemoveIndex );
+    LineRun* linesBuffer = mVisualModel->mLines.Begin();
+    mVisualModel->mLines.Erase( linesBuffer + startRemoveIndex,
+                                linesBuffer + endRemoveIndex );
+  }
+
+  if( COLOR & operations )
+  {
+    if( 0u != mVisualModel->mColorIndices.Count() )
+    {
+      ColorIndex* colorIndexBuffer = mVisualModel->mColorIndices.Begin();
+      mVisualModel->mColorIndices.Erase( colorIndexBuffer + mTextUpdateInfo.mStartGlyphIndex,
+                                         colorIndexBuffer + endGlyphIndexPlusOne );
     }
   }
 }
@@ -628,12 +637,9 @@ void Controller::Impl::ClearModelData( CharacterIndex startIndex, CharacterIndex
   mTextUpdateInfo.mEstimatedNumberOfLines = std::max( mVisualModel->mLines.Count(), mLogicalModel->mParagraphInfo.Count() );
 
   mVisualModel->ClearCaches();
-
-  // TODO finish the mark-up.
-  mVisualModel->mColorRuns.Clear();
 }
 
-void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
+bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
 {
   DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::UpdateModel\n" );
 
@@ -643,7 +649,7 @@ void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
   if( NO_OPERATION == operations )
   {
     // Nothing to do if no operations are pending and required.
-    return;
+    return false;
   }
 
   Vector<Character>& utf32Characters = mLogicalModel->mText;
@@ -666,6 +672,9 @@ void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
 
   mTextUpdateInfo.mClearAll = false;
 
+  // Whether the model is updated.
+  bool updated = false;
+
   Vector<LineBreakInfo>& lineBreakInfo = mLogicalModel->mLineBreakInfo;
   const Length requestedNumberOfCharacters = mTextUpdateInfo.mRequestedNumberOfCharacters;
 
@@ -685,6 +694,7 @@ void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
     // Create the paragraph info.
     mLogicalModel->CreateParagraphInfo( startIndex,
                                         requestedNumberOfCharacters );
+    updated = true;
   }
 
   Vector<WordBreakInfo>& wordBreakInfo = mLogicalModel->mWordBreakInfo;
@@ -697,6 +707,7 @@ void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
                       startIndex,
                       requestedNumberOfCharacters,
                       wordBreakInfo );
+    updated = true;
   }
 
   const bool getScripts = GET_SCRIPTS & operations;
@@ -738,6 +749,7 @@ void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
                                           requestedNumberOfCharacters,
                                           validFonts );
     }
+    updated = true;
   }
 
   Vector<Character> mirroredUtf32Characters;
@@ -781,6 +793,7 @@ void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
       // There is no right to left characters. Clear the directions vector.
       mLogicalModel->mCharacterDirections.Clear();
     }
+    updated = true;
   }
 
   Vector<GlyphInfo>& glyphs = mVisualModel->mGlyphs;
@@ -809,6 +822,7 @@ void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
     // Create the 'number of glyphs' per character and the glyph to character conversion tables.
     mVisualModel->CreateGlyphsPerCharacterTable( startIndex, mTextUpdateInfo.mStartGlyphIndex, requestedNumberOfCharacters );
     mVisualModel->CreateCharacterToGlyphTable( startIndex, mTextUpdateInfo.mStartGlyphIndex, requestedNumberOfCharacters );
+    updated = true;
   }
 
   const Length numberOfGlyphs = glyphs.Count() - currentNumberOfGlyphs;
@@ -828,6 +842,22 @@ void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
       glyph.width = 0.f;
       glyph.advance = 0.f;
     }
+    updated = true;
+  }
+
+  if( COLOR & operationsRequired )
+  {
+    // Set the color runs in glyphs.
+    SetColorSegmentationInfo( mLogicalModel->mColorRuns,
+                              mVisualModel->mCharactersToGlyph,
+                              mVisualModel->mGlyphsPerCharacter,
+                              startIndex,
+                              mTextUpdateInfo.mStartGlyphIndex,
+                              requestedNumberOfCharacters,
+                              mVisualModel->mColors,
+                              mVisualModel->mColorIndices );
+
+    updated = true;
   }
 
   if( ( NULL != mEventData ) &&
@@ -856,22 +886,6 @@ void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
 
   // Set the previous number of characters for the next time the text is updated.
   mTextUpdateInfo.mPreviousNumberOfCharacters = numberOfCharacters;
-}
-
-bool Controller::Impl::UpdateModelStyle( OperationsMask operationsRequired )
-{
-  bool updated = false;
-
-  if( COLOR & operationsRequired )
-  {
-    // Set the color runs in glyphs.
-    SetColorSegmentationInfo( mLogicalModel->mColorRuns,
-                              mVisualModel->mCharactersToGlyph,
-                              mVisualModel->mGlyphsPerCharacter,
-                              mVisualModel->mColorRuns );
-
-    updated = true;
-  }
 
   return updated;
 }
@@ -880,6 +894,7 @@ void Controller::Impl::RetrieveDefaultInputStyle( InputStyle& inputStyle )
 {
   // Sets the default text's color.
   inputStyle.textColor = mTextColor;
+  inputStyle.isDefaultColor = true;
 
   // Sets the default font's family name, weight, width, slant and size.
   if( mFontDefaults )
index 2f14702..4e566ab 100644 (file)
@@ -478,7 +478,7 @@ struct Controller::Impl
   void ClearModelData( CharacterIndex startIndex, CharacterIndex endIndex, OperationsMask operations );
 
   /**
-   * @brief Updates the logical and visual models.
+   * @brief Updates the logical and visual models. Updates the style runs in the visual model when the text's styles changes.
    *
    * When text or style changes the model is set with some operations pending.
    * When i.e. the text's size or a relayout is required this method is called
@@ -486,17 +486,10 @@ struct Controller::Impl
    * matched with the operations pending to perform the minimum number of operations.
    *
    * @param[in] operationsRequired The operations required.
-   */
-  void UpdateModel( OperationsMask operationsRequired );
-
-  /**
-   * @brief Updates the style runs in the visual model when the text's styles changes.
-   *
-   * @param[in] operationsRequired The operations required.
    *
    * @return @e true if the model has been modified.
    */
-  bool UpdateModelStyle( OperationsMask operationsRequired );
+  bool UpdateModel( OperationsMask operationsRequired );
 
   /**
    * @brief Retreieves the default style.
index 3500985..0ea1d70 100644 (file)
@@ -159,6 +159,8 @@ void Controller::SetText( const std::string& text )
 
   if( !text.empty() )
   {
+    mImpl->mVisualModel->SetTextColor( mImpl->mTextColor );
+
     MarkupProcessData markupProcessData( mImpl->mLogicalModel->mColorRuns,
                                          mImpl->mLogicalModel->mFontDescriptionRuns );
 
@@ -667,6 +669,7 @@ void Controller::SetInputColor( const Vector4& color )
   if( NULL != mImpl->mEventData )
   {
     mImpl->mEventData->mInputStyle.textColor = color;
+    mImpl->mEventData->mInputStyle.isDefaultColor = false;
 
     if( EventData::SELECTING == mImpl->mEventData->mState )
     {
@@ -688,6 +691,10 @@ void Controller::SetInputColor( const Vector4& color )
       // Request to relayout.
       mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | COLOR );
       mImpl->RequestRelayout();
+
+      mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
+      mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
+      mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
     }
   }
 }
@@ -1114,6 +1121,7 @@ bool Controller::Relayout( const Size& size )
 
     // Not worth to relayout if width or height is equal to zero.
     DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::Relayout (skipped)\n" );
+
     return glyphsRemoved;
   }
 
@@ -1136,21 +1144,16 @@ bool Controller::Relayout( const Size& size )
   }
 
   // Whether there are modify events.
-  const bool isModifyEventsEmpty = 0u == mImpl->mModifyEvents.Count();
-
-  // Make sure the model is up-to-date before layouting.
-  ProcessModifyEvents();
-  mImpl->UpdateModel( mImpl->mOperationsPending );
-
-  // Style operations that need to be done if the text is modified.
-  if( !isModifyEventsEmpty )
+  if( 0u != mImpl->mModifyEvents.Count() )
   {
+    // Style operations that need to be done if the text is modified.
     mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
                                                              COLOR );
   }
 
-  // Apply the style runs if text is modified.
-  bool updated = mImpl->UpdateModelStyle( mImpl->mOperationsPending );
+  // Make sure the model is up-to-date before layouting.
+  ProcessModifyEvents();
+  bool updated = mImpl->UpdateModel( mImpl->mOperationsPending );
 
   // Layout the text.
   Size layoutSize;
@@ -1191,8 +1194,8 @@ bool Controller::Relayout( const Size& size )
 
   // Clear the update info. This info will be set the next time the text is updated.
   mImpl->mTextUpdateInfo.Clear();
-
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::Relayout\n" );
+
   return updated;
 }
 
@@ -1890,10 +1893,11 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
 
     // Retrieve the text's style for the given index.
     InputStyle style;
+    mImpl->RetrieveDefaultInputStyle( style );
     mImpl->mLogicalModel->RetrieveStyle( styleIndex, style );
 
     // Whether to add a new text color run.
-    const bool addColorRun = style.textColor != mImpl->mEventData->mInputStyle.textColor;
+    const bool addColorRun = ( style.textColor != mImpl->mEventData->mInputStyle.textColor );
 
     // Whether to add a new font run.
     const bool addFontNameRun = style.familyName != mImpl->mEventData->mInputStyle.familyName;
index 0e9fb3f..2884119 100644 (file)
@@ -60,6 +60,7 @@ typedef uint32_t                         BidirectionalRunIndex;     ///< An inde
 typedef uint32_t                         BidirectionalLineRunIndex; ///< An index into an array of bidirectional line info.
 typedef uint32_t                         LineIndex;                 ///< An index into an array of lines.
 typedef uint32_t                         ParagraphRunIndex;         ///< An index into an array of paragraphs.
+typedef uint32_t                         ColorIndex;                ///< An index into an array of colors.
 
 } // namespace Text
 
index c121f77..f5f1c49 100644 (file)
@@ -87,7 +87,6 @@ public:
    *
    * @param[out] glyphs Pointer to a buffer where the glyphs are copied.
    * @param[out] glyphPositions Pointer to a buffer where the glyph's positions are copied.
-   * @param[out] colors Pointer to a buffer where the glyph's colors are copied.
    * @param[in] glyphIndex Index to the first glyph.
    * @param[in] numberOfGlyphs Number of glyphs to be copied.
    *
@@ -95,11 +94,24 @@ public:
    */
   virtual Length GetGlyphs( GlyphInfo* glyphs,
                             Vector2* glyphPositions,
-                            Vector4* glyphColors,
                             GlyphIndex glyphIndex,
                             Length numberOfGlyphs ) const = 0;
 
   /**
+   * @brief Retrieves the vector of colors.
+   *
+   * @return Pointer to the vector of colors.
+   */
+  virtual const Vector4* const GetColors() const = 0;
+
+  /**
+   * @brief Retrieves the vector of indices to the vector of colors.
+   *
+   * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
+   */
+  virtual const ColorIndex* const GetColorIndices() const = 0;
+
+  /**
    * @brief Retrieves the text color
    *
    * @return The text color
index 130c8af..be6ac8f 100644 (file)
@@ -94,7 +94,6 @@ Length View::GetNumberOfGlyphs() const
 
 Length View::GetGlyphs( GlyphInfo* glyphs,
                         Vector2* glyphPositions,
-                        Vector4* glyphColors,
                         GlyphIndex glyphIndex,
                         Length numberOfGlyphs ) const
 {
@@ -132,30 +131,6 @@ Length View::GetGlyphs( GlyphInfo* glyphs,
                                                 glyphIndex,
                                                 numberOfLaidOutGlyphs );
 
-        // Set the colors.
-        const GlyphIndex lastLaidOutGlyphIndex = glyphIndex + numberOfLaidOutGlyphs;
-
-        for( Vector<ColorGlyphRun>::ConstIterator it = mImpl->mVisualModel->mColorRuns.Begin(),
-               endIt = mImpl->mVisualModel->mColorRuns.End();
-             it != endIt;
-             ++it )
-        {
-          const ColorGlyphRun& colorGlyphRun = *it;
-          const GlyphIndex lastGlyphIndex = colorGlyphRun.glyphRun.glyphIndex + colorGlyphRun.glyphRun.numberOfGlyphs;
-
-          if( ( colorGlyphRun.glyphRun.glyphIndex < lastLaidOutGlyphIndex ) &&
-              ( glyphIndex < lastGlyphIndex ) )
-          {
-            for( GlyphIndex index = glyphIndex < colorGlyphRun.glyphRun.glyphIndex ? colorGlyphRun.glyphRun.glyphIndex : glyphIndex,
-                   endIndex = lastLaidOutGlyphIndex < lastGlyphIndex ? lastLaidOutGlyphIndex : lastGlyphIndex;
-                 index < endIndex;
-                 ++index )
-            {
-              *( glyphColors + index - glyphIndex ) = colorGlyphRun.color;
-            }
-          }
-        }
-
         // Get the lines for the given range of glyphs.
         // The lines contain the alignment offset which needs to be added to the glyph's position.
         LineIndex firstLine = 0u;
@@ -310,6 +285,26 @@ Length View::GetGlyphs( GlyphInfo* glyphs,
   return numberOfLaidOutGlyphs;
 }
 
+const Vector4* const View::GetColors() const
+{
+  if( mImpl->mVisualModel )
+  {
+    return mImpl->mVisualModel->mColors.Begin();
+  }
+
+  return NULL;
+}
+
+const ColorIndex* const View::GetColorIndices() const
+{
+  if( mImpl->mVisualModel )
+  {
+    return mImpl->mVisualModel->mColorIndices.Begin();
+  }
+
+  return NULL;
+}
+
 const Vector4& View::GetTextColor() const
 {
   if( mImpl->mVisualModel )
index 0067f94..8ec9af1 100644 (file)
@@ -75,11 +75,20 @@ public:
    */
   virtual Length GetGlyphs( GlyphInfo* glyphs,
                             Vector2* glyphPositions,
-                            Vector4* glyphColors,
                             GlyphIndex glyphIndex,
                             Length numberOfGlyphs ) const;
 
   /**
+   * @copydoc Dali::Toolkit::Text::ViewInterface::GetColors()
+   */
+  virtual const Vector4* const GetColors() const;
+
+  /**
+   * @copydoc Dali::Toolkit::Text::ViewInterface::GetColorIndices()
+   */
+  virtual const ColorIndex* const GetColorIndices() const;
+
+  /**
    * @copydoc Dali::Toolkit::Text::ViewInterface::GetTextColor()
    */
   virtual const Vector4& GetTextColor() const;
index 5aa90af..88e3930 100644 (file)
@@ -310,7 +310,8 @@ public:
   Vector<Vector2>        mGlyphPositions;       ///< For each glyph, the position.
   Vector<LineRun>        mLines;                ///< The laid out lines.
   Vector<GlyphRun>       mUnderlineRuns;        ///< Runs of glyphs that are underlined.
-  Vector<ColorGlyphRun>  mColorRuns;            ///< Runs of glyphs with the same color.
+  Vector<Vector4>        mColors;               ///< Colors of the glyphs.
+  Vector<ColorIndex>     mColorIndices;         ///< Indices to the vector of colors for each glyphs.
 
   Vector2                mControlSize;           ///< The size of the UI control the decorator is adding it's decorations to.
   Vector4                mTextColor;            ///< The text color