TextActor - New constructor with a parameter object replaces previous constructors.
[platform/core/uifw/dali-core.git] / dali / internal / event / text / generator / text-vertex-generator.cpp
index 5335fd4..4914e60 100644 (file)
@@ -1,18 +1,19 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // FILE HEADER
 #include "text-vertex-generator.h"
@@ -273,11 +274,11 @@ void DebugVertexBuffer( VertexBuffer& buffer )
 
 } // unnamed namespace
 
-TextVertexBuffer* TextVertexGenerator::Generate(const TextArray& text,
-                           const TextFormat& format,
-                           const FontMetricsInterface& metrics,
-                           const AtlasUvInterface& uvInterface,
-                           const FontId fontId)
+TextVertexBuffer* TextVertexGenerator::Generate( const TextArray& text,
+                                                 const TextFormat& format,
+                                                 const FontMetricsInterface& metrics,
+                                                 const AtlasUvInterface& uvInterface,
+                                                 FontId fontId )
 
 {
   TextVertexBuffer* textVertexBuffer = new TextVertexBuffer;
@@ -306,12 +307,10 @@ TextVertexBuffer* TextVertexGenerator::Generate(const TextArray& text,
   const float padAdjustY( metrics.GetPadAdjustY() );
   const float tileWidth( metrics.GetMaxWidth() * scalar );
   const float tileHeight( metrics.GetMaxHeight() * scalar );
-  unsigned int textSize = text.size();
 
-  for (unsigned int i = 0; i < textSize; ++i)
+  for( TextArray::const_iterator it = text.begin(), endIt = text.end(); it != endIt; ++it )
   {
-    // buffer is always filled starting from the first vector position. However text characters are visited from left to right or from right to left.
-    uint32_t charIndex = text[ ( format.IsLeftToRight() ? i : ( textSize - 1 - i ) ) ];
+    const uint32_t charIndex = *it;
 
     glyph = metrics.GetGlyph( charIndex );