Stop using ImageActor in PageTurnView
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / renderers / image / image-renderer.cpp
index b8c6343..17eae58 100644 (file)
@@ -109,34 +109,6 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   }\n
 );
 
-
-Geometry GenerateGeometry( const Vector< Vector2 >& vertices, const Vector< unsigned int >& indices )
-{
-  Property::Map vertexFormat;
-  vertexFormat[ "aPosition" ] = Property::VECTOR2;
-  PropertyBuffer vertexPropertyBuffer = PropertyBuffer::New( vertexFormat );
-  if( vertices.Size() > 0 )
-  {
-    vertexPropertyBuffer.SetData( &vertices[ 0 ], vertices.Size() );
-  }
-
-  Property::Map indexFormat;
-  indexFormat[ "indices" ] = Property::INTEGER;
-  PropertyBuffer indexPropertyBuffer = PropertyBuffer::New( indexFormat );
-  if( indices.Size() > 0 )
-  {
-    indexPropertyBuffer.SetData( &indices[ 0 ], indices.Size() );
-  }
-
-  // Create the geometry object
-  Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer( vertexPropertyBuffer );
-  geometry.SetIndexBuffer( indexPropertyBuffer );
-  geometry.SetGeometryType( Geometry::TRIANGLE_STRIP );
-
-  return geometry;
-}
-
 Geometry CreateGeometry( RendererFactoryCache& factoryCache, ImageDimensions gridSize )
 {
   Geometry geometry;
@@ -146,54 +118,13 @@ Geometry CreateGeometry( RendererFactoryCache& factoryCache, ImageDimensions gri
     geometry = factoryCache.GetGeometry( RendererFactoryCache::QUAD_GEOMETRY );
     if( !geometry )
     {
-      geometry =  factoryCache.CreateQuadGeometry();
+      geometry =  RendererFactoryCache::CreateQuadGeometry();
       factoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
     }
   }
   else
   {
-    uint16_t gridWidth = gridSize.GetWidth();
-    uint16_t gridHeight = gridSize.GetHeight();
-
-    // Create vertices
-    Vector< Vector2 > vertices;
-    vertices.Reserve( ( gridWidth + 1 ) * ( gridHeight + 1 ) );
-
-    for( int y = 0; y < gridHeight + 1; ++y )
-    {
-      for( int x = 0; x < gridWidth + 1; ++x )
-      {
-        vertices.PushBack( Vector2( (float)x/gridWidth - 0.5f, (float)y/gridHeight  - 0.5f) );
-      }
-    }
-
-    // Create indices
-    Vector< unsigned int > indices;
-    indices.Reserve( (gridWidth+2)*gridHeight*2 - 2);
-
-    for( unsigned int row = 0u; row < gridHeight; ++row )
-    {
-      unsigned int rowStartIndex = row*(gridWidth+1u);
-      unsigned int nextRowStartIndex = rowStartIndex + gridWidth +1u;
-
-      if( row != 0u ) // degenerate index on non-first row
-      {
-        indices.PushBack( rowStartIndex );
-      }
-
-      for( unsigned int column = 0u; column < gridWidth+1u; column++) // main strip
-      {
-        indices.PushBack( rowStartIndex + column);
-        indices.PushBack( nextRowStartIndex + column);
-      }
-
-      if( row != gridHeight-1u ) // degenerate index on non-last row
-      {
-        indices.PushBack( nextRowStartIndex + gridWidth );
-      }
-    }
-
-    return GenerateGeometry( vertices, indices );
+    geometry = RendererFactoryCache::CreateGridGeometry( gridSize );
   }
 
   return geometry;