TextDecorator. Do not destroy the highlight geometry every OnRelayout. 26/43026/5
authorVictor Cebollada <v.cebollada@samsung.com>
Mon, 6 Jul 2015 15:13:02 +0000 (16:13 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Wed, 15 Jul 2015 13:58:37 +0000 (14:58 +0100)
Change-Id: I0edd86d8799c98767111b5abb5a4a71fbf928c93
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali-toolkit/internal/text/decorator/text-decorator.cpp

index 49fe080..2eacef4 100644 (file)
@@ -805,24 +805,25 @@ struct Decorator::Impl : public ConnectionTracker
         mQuadVertices.SetData( &vertices[ 0 ] );
         mQuadIndices.SetData( &indices[ 0 ] );
 
-        mQuadGeometry = Geometry::New();
-        mQuadGeometry.AddVertexBuffer( mQuadVertices );
-        mQuadGeometry.SetIndexBuffer( mQuadIndices );
-
-        if( mHighlightRenderer )
+        if( !mQuadGeometry )
         {
-          mHighlightRenderer.SetGeometry( mQuadGeometry );
+          mQuadGeometry = Geometry::New();
+          mQuadGeometry.AddVertexBuffer( mQuadVertices );
         }
-        else
+        mQuadGeometry.SetIndexBuffer( mQuadIndices );
+
+        if( !mHighlightRenderer )
         {
           mHighlightRenderer = Dali::Renderer::New( mQuadGeometry, mHighlightMaterial );
           mHighlightActor.AddRenderer( mHighlightRenderer );
         }
-
-        mHighlightActor.SetPosition( mHighlightPosition.x,
-                                     mHighlightPosition.y );
       }
 
+      mHighlightActor.SetPosition( mHighlightPosition.x,
+                                   mHighlightPosition.y );
+
+      mHighlightQuadList.clear();
+
       mHighlightRenderer.SetDepthIndex( mTextDepth - 2u ); // text is rendered at mTextDepth and text's shadow at mTextDepth -1u.
     }
   }