Moved Core Rendering API from devel-api to public-api
[platform/core/uifw/dali-demo.git] / examples / benchmark / benchmark.cpp
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // EXTERNAL INCLUDES
19 #include <dali/public-api/rendering/renderer.h>
20 #include <dali-toolkit/dali-toolkit.h>
21
22 // INTERNAL INCLUDES
23 #include "shared/utility.h"
24
25 using namespace Dali;
26 using namespace Dali::Toolkit;
27
28
29 namespace
30 {
31 const char* IMAGE_PATH[] = {
32                             DEMO_IMAGE_DIR "gallery-medium-1.jpg",
33                             DEMO_IMAGE_DIR "gallery-medium-2.jpg",
34                             DEMO_IMAGE_DIR "gallery-medium-3.jpg",
35                             DEMO_IMAGE_DIR "gallery-medium-4.jpg",
36                             DEMO_IMAGE_DIR "gallery-medium-5.jpg",
37                             DEMO_IMAGE_DIR "gallery-medium-6.jpg",
38                             DEMO_IMAGE_DIR "gallery-medium-7.jpg",
39                             DEMO_IMAGE_DIR "gallery-medium-8.jpg",
40                             DEMO_IMAGE_DIR "gallery-medium-9.jpg",
41                             DEMO_IMAGE_DIR "gallery-medium-10.jpg",
42                             DEMO_IMAGE_DIR "gallery-medium-11.jpg",
43                             DEMO_IMAGE_DIR "gallery-medium-12.jpg",
44                             DEMO_IMAGE_DIR "gallery-medium-13.jpg",
45                             DEMO_IMAGE_DIR "gallery-medium-14.jpg",
46                             DEMO_IMAGE_DIR "gallery-medium-15.jpg",
47                             DEMO_IMAGE_DIR "gallery-medium-16.jpg",
48                             DEMO_IMAGE_DIR "gallery-medium-17.jpg",
49                             DEMO_IMAGE_DIR "gallery-medium-18.jpg",
50                             DEMO_IMAGE_DIR "gallery-medium-19.jpg",
51                             DEMO_IMAGE_DIR "gallery-medium-20.jpg",
52                             DEMO_IMAGE_DIR "gallery-medium-21.jpg",
53                             DEMO_IMAGE_DIR "gallery-medium-22.jpg",
54                             DEMO_IMAGE_DIR "gallery-medium-23.jpg",
55                             DEMO_IMAGE_DIR "gallery-medium-24.jpg",
56                             DEMO_IMAGE_DIR "gallery-medium-25.jpg",
57                             DEMO_IMAGE_DIR "gallery-medium-26.jpg",
58                             DEMO_IMAGE_DIR "gallery-medium-27.jpg",
59                             DEMO_IMAGE_DIR "gallery-medium-28.jpg",
60                             DEMO_IMAGE_DIR "gallery-medium-29.jpg",
61                             DEMO_IMAGE_DIR "gallery-medium-30.jpg",
62                             DEMO_IMAGE_DIR "gallery-medium-31.jpg",
63                             DEMO_IMAGE_DIR "gallery-medium-32.jpg",
64                             DEMO_IMAGE_DIR "gallery-medium-33.jpg",
65                             DEMO_IMAGE_DIR "gallery-medium-34.jpg",
66                             DEMO_IMAGE_DIR "gallery-medium-35.jpg",
67                             DEMO_IMAGE_DIR "gallery-medium-36.jpg",
68                             DEMO_IMAGE_DIR "gallery-medium-37.jpg",
69                             DEMO_IMAGE_DIR "gallery-medium-38.jpg",
70                             DEMO_IMAGE_DIR "gallery-medium-39.jpg",
71                             DEMO_IMAGE_DIR "gallery-medium-40.jpg",
72                             DEMO_IMAGE_DIR "gallery-medium-41.jpg",
73                             DEMO_IMAGE_DIR "gallery-medium-42.jpg",
74                             DEMO_IMAGE_DIR "gallery-medium-43.jpg",
75                             DEMO_IMAGE_DIR "gallery-medium-44.jpg",
76                             DEMO_IMAGE_DIR "gallery-medium-45.jpg",
77                             DEMO_IMAGE_DIR "gallery-medium-46.jpg",
78                             DEMO_IMAGE_DIR "gallery-medium-47.jpg",
79                             DEMO_IMAGE_DIR "gallery-medium-48.jpg",
80                             DEMO_IMAGE_DIR "gallery-medium-49.jpg",
81                             DEMO_IMAGE_DIR "gallery-medium-50.jpg",
82                             DEMO_IMAGE_DIR "gallery-medium-51.jpg",
83                             DEMO_IMAGE_DIR "gallery-medium-52.jpg",
84                             DEMO_IMAGE_DIR "gallery-medium-53.jpg",
85 };
86
87 const char* NINEPATCH_IMAGE_PATH[] = {
88                             DEMO_IMAGE_DIR "selection-popup-bg.1.9.png",
89                             DEMO_IMAGE_DIR "selection-popup-bg.2.9.png",
90                             DEMO_IMAGE_DIR "selection-popup-bg.3.9.png",
91                             DEMO_IMAGE_DIR "selection-popup-bg.4.9.png",
92                             DEMO_IMAGE_DIR "selection-popup-bg.5.9.png",
93                             DEMO_IMAGE_DIR "selection-popup-bg.6.9.png",
94                             DEMO_IMAGE_DIR "selection-popup-bg.7.9.png",
95                             DEMO_IMAGE_DIR "selection-popup-bg.8.9.png",
96                             DEMO_IMAGE_DIR "selection-popup-bg.9.9.png",
97                             DEMO_IMAGE_DIR "selection-popup-bg.10.9.png",
98                             DEMO_IMAGE_DIR "selection-popup-bg.11.9.png",
99                             DEMO_IMAGE_DIR "selection-popup-bg.12.9.png",
100                             DEMO_IMAGE_DIR "selection-popup-bg.13.9.png",
101                             DEMO_IMAGE_DIR "selection-popup-bg.14.9.png",
102                             DEMO_IMAGE_DIR "selection-popup-bg.15.9.png",
103                             DEMO_IMAGE_DIR "selection-popup-bg.16.9.png",
104                             DEMO_IMAGE_DIR "selection-popup-bg.17.9.png",
105                             DEMO_IMAGE_DIR "selection-popup-bg.18.9.png",
106                             DEMO_IMAGE_DIR "selection-popup-bg.19.9.png",
107                             DEMO_IMAGE_DIR "selection-popup-bg.20.9.png",
108                             DEMO_IMAGE_DIR "selection-popup-bg.21.9.png",
109                             DEMO_IMAGE_DIR "selection-popup-bg.22.9.png",
110                             DEMO_IMAGE_DIR "selection-popup-bg.23.9.png",
111                             DEMO_IMAGE_DIR "selection-popup-bg.24.9.png",
112                             DEMO_IMAGE_DIR "selection-popup-bg.25.9.png",
113                             DEMO_IMAGE_DIR "selection-popup-bg.26.9.png",
114                             DEMO_IMAGE_DIR "selection-popup-bg.27.9.png",
115                             DEMO_IMAGE_DIR "selection-popup-bg.28.9.png",
116                             DEMO_IMAGE_DIR "selection-popup-bg.29.9.png",
117                             DEMO_IMAGE_DIR "selection-popup-bg.30.9.png",
118                             DEMO_IMAGE_DIR "selection-popup-bg.31.9.png",
119                             DEMO_IMAGE_DIR "selection-popup-bg.32.9.png",
120                             DEMO_IMAGE_DIR "selection-popup-bg.33.9.png",
121                             DEMO_IMAGE_DIR "button-disabled.9.png",
122                             DEMO_IMAGE_DIR "button-down.9.png",
123                             DEMO_IMAGE_DIR "button-down-disabled.9.png",
124                             DEMO_IMAGE_DIR "button-up-1.9.png",
125                             DEMO_IMAGE_DIR "button-up-2.9.png",
126                             DEMO_IMAGE_DIR "button-up-3.9.png",
127                             DEMO_IMAGE_DIR "button-up-4.9.png",
128                             DEMO_IMAGE_DIR "button-up-5.9.png",
129                             DEMO_IMAGE_DIR "button-up-6.9.png",
130                             DEMO_IMAGE_DIR "button-up-7.9.png",
131                             DEMO_IMAGE_DIR "button-up-8.9.png",
132                             DEMO_IMAGE_DIR "button-up-9.9.png",
133                             DEMO_IMAGE_DIR "button-up-10.9.png",
134                             DEMO_IMAGE_DIR "button-up-11.9.png",
135                             DEMO_IMAGE_DIR "button-up-12.9.png",
136                             DEMO_IMAGE_DIR "button-up-13.9.png",
137                             DEMO_IMAGE_DIR "button-up-14.9.png",
138                             DEMO_IMAGE_DIR "button-up-15.9.png",
139                             DEMO_IMAGE_DIR "button-up-16.9.png",
140                             DEMO_IMAGE_DIR "button-up-17.9.png",
141 };
142
143 const unsigned int NUM_IMAGES = sizeof(IMAGE_PATH) / sizeof(char*);
144 const unsigned int NUM_NINEPATCH_IMAGES = sizeof(NINEPATCH_IMAGE_PATH) / sizeof(char*);
145
146 const float ANIMATION_TIME ( 5.0f ); // animation length in seconds
147
148 struct VertexWithTexture
149 {
150   Vector2 position;
151   Vector2 texCoord;
152 };
153
154 VertexWithTexture gQuadWithTexture[] = {
155                                         { Vector2( -0.5f, -0.5f ), Vector2( 0.0f, 0.0f ) },
156                                         { Vector2(  0.5f, -0.5f ), Vector2( 1.0f, 0.0f ) },
157                                         { Vector2( -0.5f,  0.5f ), Vector2( 0.0f, 1.0f ) },
158                                         { Vector2(  0.5f,  0.5f ), Vector2( 1.0f, 1.0f ) }
159 };
160
161 const char* VERTEX_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
162     attribute mediump vec2 aPosition;\n
163     attribute mediump vec2 aTexCoord;\n
164     uniform mediump mat4 uMvpMatrix;\n
165     uniform mediump vec3 uSize;\n
166     varying mediump vec2 vTexCoord;\n
167     void main()\n
168     {\n
169       vec4 position = vec4(aPosition,0.0,1.0)*vec4(uSize,1.0);\n
170       gl_Position = uMvpMatrix * position;\n
171       vTexCoord = aTexCoord;\n
172     }\n
173 );
174
175 const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
176     uniform lowp vec4 uColor;\n
177     uniform sampler2D sTexture;\n
178     varying mediump vec2 vTexCoord;\n
179
180     void main()\n
181     {\n
182       gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
183     }\n
184 );
185
186 bool gUseMesh(false);
187 bool gUseImageActor(false);
188 bool gNinePatch(false);
189 unsigned int gRowsPerPage(25);
190 unsigned int gColumnsPerPage( 25 );
191 unsigned int gPageCount(13);
192
193 Renderer CreateRenderer( unsigned int index, Geometry geometry, Shader shader )
194 {
195   Renderer renderer = Renderer::New( geometry, shader );
196   const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index];
197   Texture texture = DemoHelper::LoadTexture( imagePath );
198   TextureSet textureSet = TextureSet::New();
199   textureSet.SetTexture( 0u, texture );
200   renderer.SetTextures( textureSet );
201   renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
202   return renderer;
203 }
204
205 }
206 // Test application to compare performance between ImageActor and ImageView
207 // By default, the application consist of 10 pages of 25x25 Image views, this can be modified using the following command line arguments:
208 // -r NumberOfRows  (Modifies the number of rows per page)
209 // -c NumberOfColumns (Modifies the number of columns per page)
210 // -p NumberOfPages (Modifies the nimber of pages )
211 // --use-image-actor ( Use ImageActor instead of ImageView )
212 // --use-mesh ( Use new renderer API (as ImageView) but shares renderers between actors when possible )
213 // --nine-patch ( Use nine patch images )
214
215 //
216 class Benchmark : public ConnectionTracker
217 {
218 public:
219
220   Benchmark( Application& application )
221 : mApplication( application ),
222   mRowsPerPage( gRowsPerPage ),
223   mColumnsPerPage( gColumnsPerPage ),
224   mPageCount( gPageCount )
225 {
226     // Connect to the Application's Init signal
227     mApplication.InitSignal().Connect( this, &Benchmark::Create );
228 }
229
230   ~Benchmark()
231   {
232     // Nothing to do here;
233   }
234
235   // The Init signal is received once (only) during the Application lifetime
236   void Create( Application& application )
237   {
238     // Get a handle to the stage
239     Stage stage = Stage::GetCurrent();
240     stage.SetBackgroundColor( Color::WHITE );
241     Vector2 stageSize = stage.GetSize();
242
243     stage.GetRootLayer().SetDepthTestDisabled(true);
244
245     mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f );
246
247     // Respond to a click anywhere on the stage
248     stage.GetRootLayer().TouchSignal().Connect( this, &Benchmark::OnTouch );
249
250     if( gUseMesh )
251     {
252       CreateMeshActors();
253     }
254     else if( gUseImageActor )
255     {
256       CreateImageActors();
257     }
258     else
259     {
260       CreateImageViews();
261     }
262
263     ShowAnimation();
264   }
265
266   bool OnTouch( Actor actor, const TouchData& touch )
267   {
268     // quit the application
269     mApplication.Quit();
270     return true;
271   }
272
273   const char* ImagePath( int i )
274   {
275     return !gNinePatch ? IMAGE_PATH[i % NUM_IMAGES] : NINEPATCH_IMAGE_PATH[i % NUM_NINEPATCH_IMAGES];
276   }
277
278   void CreateImageActors()
279   {
280     Stage stage = Stage::GetCurrent();
281     unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount);
282     mActor.resize(actorCount);
283
284     for( size_t i(0); i<actorCount; ++i )
285     {
286       Image image = ResourceImage::New(ImagePath(i));
287       mActor[i] = ImageActor::New(image);
288       mActor[i].SetSize(Vector3(0.0f,0.0f,0.0f));
289       mActor[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
290       stage.Add(mActor[i]);
291     }
292   }
293
294   void CreateImageViews()
295   {
296     Stage stage = Stage::GetCurrent();
297     unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount);
298     mImageView.resize(actorCount);
299
300     for( size_t i(0); i<actorCount; ++i )
301     {
302       mImageView[i] = ImageView::New(ImagePath(i));
303       mImageView[i].SetSize(Vector3(0.0f,0.0f,0.0f));
304       mImageView[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
305       stage.Add(mImageView[i]);
306     }
307   }
308
309   void CreateMeshActors()
310   {
311     unsigned int numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES;
312
313     //Create all the renderers
314     std::vector<Renderer> renderers( numImages );
315     Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE );
316     Geometry geometry = DemoHelper::CreateTexturedQuad();
317     for( unsigned int i(0); i<numImages; ++i )
318     {
319       renderers[i] = CreateRenderer( i, geometry, shader );
320     }
321
322     //Create the actors
323     Stage stage = Stage::GetCurrent();
324     unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount);
325     mActor.resize(actorCount);
326     for( size_t i(0); i<actorCount; ++i )
327     {
328       mActor[i] = Actor::New();
329       mActor[i].AddRenderer( renderers[i % numImages] );
330       mActor[i].SetSize(0.0f,0.0f,0.0f);
331       stage.Add(mActor[i]);
332     }
333   }
334
335   void OnAnimationEnd( Animation& source )
336   {
337     if( source == mShow )
338     {
339       ScrollAnimation();
340     }
341     else if( source == mScroll )
342     {
343       HideAnimation();
344     }
345     else
346     {
347       mApplication.Quit();
348     }
349   }
350
351   void ShowAnimation()
352   {
353     Stage stage = Stage::GetCurrent();
354     Vector3 initialPosition( stage.GetSize().x * 0.5f, stage.GetSize().y*0.5f, 1000.0f );
355
356     unsigned int totalColumns = mColumnsPerPage * mPageCount;
357
358     size_t count(0);
359     float xpos, ypos;
360     mShow = Animation::New(0.0f);
361
362     float totalDuration( 10.0f );
363     float durationPerActor( 0.5f );
364     float delayBetweenActors = ( totalDuration - durationPerActor) / (mRowsPerPage*mColumnsPerPage);
365     for( size_t i(0); i<totalColumns; ++i )
366     {
367       xpos = mSize.x * i;
368
369       for( size_t j(0);j<mRowsPerPage;++j)
370       {
371
372         ypos = mSize.y * j;
373
374         float delay = 0.0f;
375         float duration = 0.0f;
376         if( count < mRowsPerPage*mColumnsPerPage )
377         {
378           duration = durationPerActor;
379           delay = delayBetweenActors * count;
380         }
381         if( gUseImageActor || gUseMesh )
382         {
383           mActor[count].SetPosition( initialPosition );
384           mActor[count].SetSize( Vector3(0.0f,0.0f,0.0f) );
385           mActor[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS));
386           mShow.AnimateTo( Property( mActor[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
387           mShow.AnimateTo( Property( mActor[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
388         }
389         else
390         {
391           mImageView[count].SetPosition( initialPosition );
392           mImageView[count].SetSize( Vector3(0.0f,0.0f,0.0f) );
393           mImageView[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS));
394           mShow.AnimateTo( Property( mImageView[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
395           mShow.AnimateTo( Property( mImageView[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
396         }
397         ++count;
398       }
399     }
400     mShow.Play();
401     mShow.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd );
402   }
403
404   void ScrollAnimation()
405   {
406     Stage stage = Stage::GetCurrent();
407     Vector3 stageSize( stage.GetSize() );
408
409     mScroll = Animation::New(10.0f);
410     size_t actorCount( mRowsPerPage*mColumnsPerPage*mPageCount);
411     for( size_t i(0); i<actorCount; ++i )
412     {
413       if( gUseImageActor || gUseMesh )
414       {
415         mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f));
416         mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f));
417         mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f));
418         mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f));
419       }
420       else
421       {
422         mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f));
423         mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f));
424         mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f));
425         mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f));
426       }
427     }
428     mScroll.Play();
429     mScroll.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd );
430   }
431
432   void HideAnimation()
433   {
434     size_t count(0);
435     unsigned int actorsPerPage( mRowsPerPage*mColumnsPerPage );
436     mHide = Animation::New(0.0f);
437
438     unsigned int totalColumns = mColumnsPerPage * mPageCount;
439
440     float finalZ = Dali::Stage::GetCurrent().GetRenderTaskList().GetTask(0).GetCameraActor().GetCurrentWorldPosition().z;
441     float totalDuration( 5.0f);
442     float durationPerActor( 0.5f );
443     float delayBetweenActors = ( totalDuration - durationPerActor) / (mRowsPerPage*mColumnsPerPage);
444     for( size_t i(0); i<mRowsPerPage; ++i )
445     {
446       for( size_t j(0);j<totalColumns;++j)
447       {
448         float delay = 0.0f;
449         float duration = 0.0f;
450         if( count < actorsPerPage )
451         {
452           duration = durationPerActor;
453           delay = delayBetweenActors * count;
454         }
455
456         if( gUseImageActor || gUseMesh )
457         {
458           mHide.AnimateTo( Property( mActor[count], Actor::Property::ORIENTATION),  Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration ));
459           mHide.AnimateBy( Property( mActor[count], Actor::Property::POSITION_Z), finalZ, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration ));
460         }
461         else
462         {
463           mHide.AnimateTo( Property( mImageView[count], Actor::Property::ORIENTATION),  Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration ));
464           mHide.AnimateBy( Property( mImageView[count], Actor::Property::POSITION_Z), finalZ, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration ));
465         }
466         ++count;
467       }
468     }
469
470     mHide.Play();
471     mHide.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd );
472   }
473
474 private:
475   Application&  mApplication;
476
477   std::vector<Actor>  mActor;
478   std::vector<ImageView>  mImageView;
479
480   Vector3             mSize;
481   unsigned int        mRowsPerPage;
482   unsigned int        mColumnsPerPage;
483   unsigned int        mPageCount;
484
485   Animation           mShow;
486   Animation           mScroll;
487   Animation           mHide;
488 };
489
490 void RunTest( Application& application )
491 {
492   Benchmark test( application );
493
494   application.MainLoop();
495 }
496
497 // Entry point for Linux & Tizen applications
498 //
499 int DALI_EXPORT_API main( int argc, char **argv )
500 {
501   Application application = Application::New( &argc, &argv );
502
503   for( int i(1) ; i < argc; ++i )
504   {
505     std::string arg( argv[i] );
506     if( arg.compare("--use-mesh") == 0)
507     {
508       gUseMesh = true;
509     }
510     else if( arg.compare("--use-image-actor") == 0)
511     {
512       gUseImageActor = true;
513     }
514     else if( arg.compare("--nine-patch" ) == 0)
515     {
516       gNinePatch = true;
517     }
518     else if( arg.compare(0, 2, "-r" ) == 0)
519     {
520       gRowsPerPage = atoi( arg.substr( 2, arg.size()).c_str());
521     }
522     else if( arg.compare(0, 2, "-c" ) == 0)
523     {
524       gColumnsPerPage = atoi( arg.substr( 2, arg.size()).c_str());
525     }
526     else if( arg.compare(0, 2, "-p" ) == 0)
527     {
528       gPageCount = atoi( arg.substr( 2, arg.size()).c_str());
529     }
530   }
531
532   RunTest( application );
533
534   return 0;
535 }