Rendering API clean-up
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / decorator / text-decorator.cpp
index bc27da3..bb393ff 100644 (file)
@@ -33,7 +33,6 @@
 #include <dali/devel-api/rendering/renderer.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/internal/controls/image-view/image-view-impl.h>
@@ -285,8 +284,7 @@ struct Decorator::Impl : public ConnectionTracker
   {
     mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
     mQuadIndexFormat[ "indices" ] = Property::INTEGER;
-    mHighlightMaterial = Material::New( Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ) );
-
+    mHighlightShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
     SetupTouchEvents();
   }
 
@@ -529,7 +527,7 @@ struct Decorator::Impl : public ConnectionTracker
   {
     cursor = Control::New();
     cursor.SetBackgroundColor( color );
-    cursor.SetParentOrigin( ParentOrigin::TOP_LEFT ); // Need to set the default parent origin as CreateSolidColorActor() sets a different one.
+    cursor.SetParentOrigin( ParentOrigin::TOP_LEFT );
     cursor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
   }
 
@@ -637,7 +635,6 @@ struct Decorator::Impl : public ConnectionTracker
 
       mActiveLayer.SetParentOrigin( ParentOrigin::CENTER );
       mActiveLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-      mActiveLayer.SetPositionInheritanceMode( USE_PARENT_POSITION );
 
       // Add the active layer telling the controller it doesn't need clipping.
       mController.AddDecoration( mActiveLayer, false );
@@ -1049,26 +1046,18 @@ struct Decorator::Impl : public ConnectionTracker
           indices.PushBack( v + 3 );
         }
 
-        if( mQuadVertices )
-        {
-          mQuadVertices.SetSize( vertices.Size() );
-        }
-        else
+        if( ! mQuadVertices )
         {
-          mQuadVertices = PropertyBuffer::New( mQuadVertexFormat, vertices.Size() );
+          mQuadVertices = PropertyBuffer::New( mQuadVertexFormat );
         }
 
-        if( mQuadIndices )
-        {
-          mQuadIndices.SetSize( indices.Size() );
-        }
-        else
+        if( ! mQuadIndices )
         {
-          mQuadIndices = PropertyBuffer::New( mQuadIndexFormat, indices.Size() );
+          mQuadIndices = PropertyBuffer::New( mQuadIndexFormat );
         }
 
-        mQuadVertices.SetData( &vertices[ 0 ] );
-        mQuadIndices.SetData( &indices[ 0 ] );
+        mQuadVertices.SetData( &vertices[ 0 ], vertices.Size() );
+        mQuadIndices.SetData( &indices[ 0 ], indices.Size() );
 
         if( !mQuadGeometry )
         {
@@ -1079,7 +1068,7 @@ struct Decorator::Impl : public ConnectionTracker
 
         if( !mHighlightRenderer )
         {
-          mHighlightRenderer = Dali::Renderer::New( mQuadGeometry, mHighlightMaterial );
+          mHighlightRenderer = Dali::Renderer::New( mQuadGeometry, mHighlightShader );
           mHighlightActor.AddRenderer( mHighlightRenderer );
         }
       }
@@ -1091,7 +1080,7 @@ struct Decorator::Impl : public ConnectionTracker
 
       if( mHighlightRenderer )
       {
-        mHighlightRenderer.SetDepthIndex( mTextDepth - 2u ); // text is rendered at mTextDepth and text's shadow at mTextDepth -1u.
+        mHighlightRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mTextDepth - 2 ); // text is rendered at mTextDepth and text's shadow at mTextDepth -1u.
       }
     }
   }
@@ -1663,7 +1652,7 @@ struct Decorator::Impl : public ConnectionTracker
 
   Actor               mHighlightActor;            ///< Actor to display highlight
   Renderer            mHighlightRenderer;
-  Material            mHighlightMaterial;         ///< Material used for highlight
+  Shader              mHighlightShader;           ///< Shader used for highlight
   Property::Map       mQuadVertexFormat;
   Property::Map       mQuadIndexFormat;
   PopupImpl           mCopyPastePopup;