Merge "Enhance texteditor background drawing performance" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / visual-model-impl.cpp
index 6c4ff9b..490bae3 100644 (file)
@@ -254,6 +254,12 @@ void VisualModel::GetNumberOfLines(GlyphIndex glyphIndex,
   }
 }
 
+LineIndex VisualModel::GetLineOfGlyph( GlyphIndex glyphIndex )
+{
+  const CharacterIndex characterIndex = *(mGlyphsToCharacters.Begin() + glyphIndex);
+  return GetLineOfCharacter(characterIndex);
+}
+
 void VisualModel::GetLinesOfGlyphRange(LineRun*   lines,
                                        GlyphIndex glyphIndex,
                                        Length     numberOfGlyphs) const
@@ -305,13 +311,13 @@ LineIndex VisualModel::GetLineOfCharacter(CharacterIndex characterIndex)
   return index;
 }
 
-void VisualModel::GetUnderlineRuns(GlyphRun*         underlineRuns,
-                                   UnderlineRunIndex index,
-                                   Length            numberOfRuns) const
+void VisualModel::GetUnderlineRuns(UnderlinedGlyphRun* underlineRuns,
+                                   UnderlineRunIndex   index,
+                                   Length              numberOfRuns) const
 {
   memcpy(underlineRuns,
          mUnderlineRuns.Begin() + index,
-         numberOfRuns * sizeof(GlyphRun));
+         numberOfRuns * sizeof(UnderlinedGlyphRun));
 }
 
 void VisualModel::SetNaturalSize(const Vector2& size)
@@ -460,6 +466,11 @@ void VisualModel::SetStrikethroughHeight(float height)
   mStrikethroughHeight = height;
 }
 
+void VisualModel::SetCharacterSpacing(float characterSpacing)
+{
+  mCharacterSpacing = characterSpacing;
+}
+
 const Vector4& VisualModel::GetTextColor() const
 {
   return mTextColor;
@@ -525,6 +536,11 @@ const Vector4& VisualModel::GetBackgroundColor() const
   return mBackgroundColor;
 }
 
+const float VisualModel::GetCharacterSpacing() const
+{
+  return mCharacterSpacing;
+}
+
 bool VisualModel::IsBackgroundEnabled() const
 {
   return mBackgroundEnabled;
@@ -599,11 +615,26 @@ Length VisualModel::GetNumberOfStrikethroughRuns() const
   return mStrikethroughRuns.Count();
 }
 
+Length VisualModel::GetNumberOfCharacterSpacingGlyphRuns() const
+{
+  return mCharacterSpacingRuns.Count();
+}
+
+const Vector<CharacterSpacingGlyphRun>& VisualModel::GetCharacterSpacingGlyphRuns() const
+{
+  return mCharacterSpacingRuns;
+}
+
 void VisualModel::ClearCaches()
 {
   mCachedLineIndex = 0u;
 }
 
+const Vector<CharacterIndex>& VisualModel::GetGlyphsToCharacters() const
+{
+  return mGlyphsToCharacters;
+}
+
 VisualModel::~VisualModel()
 {
 }
@@ -644,7 +675,8 @@ VisualModel::VisualModel()
   mUnderlineColorSet(false),
   mBackgroundEnabled(false),
   mMarkupProcessorEnabled(false),
-  mStrikethroughEnabled(false)
+  mStrikethroughEnabled(false),
+  mCharacterSpacing(0.0f)
 
 {
 }