(AnimatedVectorImages) Fixed SVACE error
[platform/core/uifw/dali-demo.git] / examples / perf-scroll / perf-scroll.cpp
index 3bfdda5..43ac252 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -15,9 +15,8 @@
  *
  */
 
-#include <dali/public-api/rendering/renderer.h>
 #include <dali-toolkit/dali-toolkit.h>
-
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include "shared/utility.h"
 
 using namespace Dali;
@@ -243,6 +242,9 @@ public:
     // Respond to a click anywhere on the stage
     stage.GetRootLayer().TouchSignal().Connect( this, &PerfScroll::OnTouch );
 
+    // Respond to key events
+    stage.KeyEventSignal().Connect( this, &PerfScroll::OnKeyEvent );
+
     mParent = Actor::New();
     mParent.SetAnchorPoint( AnchorPoint::TOP_LEFT );
     stage.Add(mParent);
@@ -279,7 +281,13 @@ public:
 
     for( size_t i(0); i<actorCount; ++i )
     {
-      mImageView[i] = ImageView::New( ImagePath(i) );
+      mImageView[i] = ImageView::New();
+      Property::Map propertyMap;
+      propertyMap.Insert(Toolkit::ImageVisual::Property::URL, ImagePath(i));
+      propertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
+      propertyMap.Insert(Toolkit::DevelVisual::Property::VISUAL_FITTING_MODE, Toolkit::DevelVisual::FILL);
+      mImageView[i].SetProperty(Toolkit::ImageView::Property::IMAGE, propertyMap);
+
       mImageView[i].SetSize( Vector3(0.0f,0.0f,0.0f) );
       mImageView[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
       mParent.Add( mImageView[i] );
@@ -435,6 +443,17 @@ public:
     mHide.FinishedSignal().Connect( this, &PerfScroll::OnAnimationEnd );
   }
 
+  void OnKeyEvent( const KeyEvent& event )
+  {
+    if( event.state == KeyEvent::Down )
+    {
+      if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
+      {
+        mApplication.Quit();
+      }
+    }
+  }
+
 private:
   Application&  mApplication;
 
@@ -452,15 +471,6 @@ private:
   Animation           mHide;
 };
 
-void RunTest( Application& application )
-{
-  PerfScroll test( application );
-
-  application.MainLoop();
-}
-
-// Entry point for Linux & Tizen applications
-//
 int DALI_EXPORT_API main( int argc, char **argv )
 {
   Application application = Application::New( &argc, &argv );
@@ -482,7 +492,8 @@ int DALI_EXPORT_API main( int argc, char **argv )
     }
   }
 
-  RunTest( application );
+  PerfScroll test( application );
+  application.MainLoop();
 
   return 0;
 }