[dali_1.1.23] Merge branch 'devel/master' 97/60497/1
authorDavid Steele <david.steele@samsung.com>
Fri, 26 Feb 2016 13:45:52 +0000 (13:45 +0000)
committerDavid Steele <david.steele@samsung.com>
Fri, 26 Feb 2016 13:45:52 +0000 (13:45 +0000)
Change-Id: Ica916337c61e4160274c24ce2009c7998bca09f6

21 files changed:
README
automated-tests/src/dali/utc-Dali-Animation.cpp
build/scripts/dali_env
dali/integration-api/core.cpp
dali/integration-api/platform-abstraction.h
dali/internal/common/message-buffer.cpp
dali/internal/event/animation/key-frame-channel.h
dali/internal/event/animation/key-frames-impl.h
dali/internal/event/common/object-impl-helper.h
dali/internal/event/common/object-impl.cpp
dali/internal/event/rendering/shader-impl.cpp
dali/internal/render/common/render-instruction.h
dali/internal/render/common/render-manager.cpp
dali/internal/render/data-providers/render-data-provider.h
dali/internal/update/animation/scene-graph-animation.cpp
dali/internal/update/common/uniform-map.cpp
dali/internal/update/manager/prepare-render-instructions.cpp
dali/internal/update/rendering/scene-graph-renderer.cpp
dali/public-api/dali-core-version.cpp
dali/public-api/shader-effects/shader-effect.cpp
packaging/dali.spec

diff --git a/README b/README
index f10e0d2..fa9e31d 100644 (file)
--- a/README
+++ b/README
@@ -10,8 +10,9 @@ T.O.C.
  2.3. Building the Repository
  2.4. Build target options
  2.5. Building and executing test cases
-
-
+ 3.   Building DALi as Javascript using Emscripten
+ 3.1. Creating a DALi Environment for Emscripten Javascript builds
+ 3.2. Building the repository as Javascript using Emscripten
 
 1. GBS Builds
 =============
@@ -62,6 +63,7 @@ Next source these variables:
 
 You will have to source these variables every time you open up a new terminal (or you can add to .bashrc if you prefer).
 
+
 2.3. Building the Repository
 ----------------------------
 
@@ -75,6 +77,7 @@ Then run the following commands:
  ./configure --prefix=$DESKTOP_PREFIX
  make install -j8
 
+
 2.4. Build target options
 -------------------------
 
@@ -96,3 +99,52 @@ Add to the gbs build line: --define "%target_gles_version X"
 
 See the README.md in dali-core/automated-tests.
 
+
+3. Building DALi as Javascript using Emscripten
+-----------------------------------------------
+
+
+3.1. Environment for Emscripten Javascript builds
+--------------------------------------------------
+
+To build the Javascript version of DALi, the Emscripten SDK is required.
+Installation of this is built in to the main dali_env script.
+
+First create a directory for the environment:
+
+# mkdir -p ~/dali-env-emscripten
+
+Now run the dali_env script. This will download and build the Emscripten SDK, which may take several minutes.
+The script may ask for your password as it will need to install any package prerequisites.
+Note the "-e" option for Emscripten.
+
+# cd ~/dali-env-emscripten
+# PATH-TO-DALI-CORE/build/scripts/dali_env -c -e
+
+Create the setenv script. A new section for Emscripten will be created at the top.
+
+# ./dali-env/dali-env -s > setenv
+
+Run the setenv script to setup environment variables.
+
+# . ./setenv
+
+Warning: As of 19/01/2015 with a userID > 6 digits there was a bug in llvm that caused
+the build to fail. So I've used the incoming branches of the emscripten sdk and not latest.
+
+
+3.2. Building the repository as Javascript using Emscripten
+-----------------------------------------------------------
+
+Clean the build first:
+
+# cd ./dali-core/build/tizen
+# git clean -dxf
+# autoreconf --install
+
+Use llvm's drop in replacements for configure & make:
+
+# emconfigure ./configure --verbose --prefix=$DESKTOP_PREFIX --enable-emscripten=yes --enable-debug=yes --enable-profile=UBUNTU --enable-gles=20
+# emmake make install -j8
+
+
index 5a288f4..856283f 100644 (file)
@@ -1189,10 +1189,12 @@ int UtcDaliAnimationGetCurrentProgressP(void)
   END_TEST;
 }
 
-int UtcDaliAnimationSetSpeedFactorP(void)
+int UtcDaliAnimationSetSpeedFactorP1(void)
 {
   TestApplication application;
 
+  tet_printf("Testing that setting a speed factor of 2 takes half the time\n");
+
   Actor actor = Actor::New();
   Stage::GetCurrent().Add(actor);
 
@@ -1246,14 +1248,38 @@ int UtcDaliAnimationSetSpeedFactorP(void)
   application.Render(0);
   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
 
-  finishCheck.Reset();
+  END_TEST;
+}
+
+int UtcDaliAnimationSetSpeedFactorP2(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+  Stage::GetCurrent().Add(actor);
+
+  // Build the animation
+  float durationSeconds(1.0f);
+  Animation animation = Animation::New(durationSeconds);
+
+  const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
+  const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
 
-  //Test -1 speed factor. Animation will play in reverse at normal speed
+  KeyFrames keyframes = KeyFrames::New();
+  keyframes.Add( 0.0f, initialPosition);
+  keyframes.Add( 1.0f, targetPosition );
+  animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+
+  tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
   animation.SetSpeedFactor( -1.0f );
 
   // Start the animation
   animation.Play();
 
+  bool signalReceived(false);
+  AnimationFinishCheck finishCheck(signalReceived);
+  animation.FinishedSignal().Connect(&application, finishCheck);
+
   application.SendNotification();
   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
 
@@ -1296,8 +1322,33 @@ int UtcDaliAnimationSetSpeedFactorP(void)
   application.Render(0);
   DALI_TEST_EQUALS( initialPosition, actor.GetCurrentPosition(), TEST_LOCATION );
 
-  //Test change speed factor on the fly
-  finishCheck.Reset();
+  END_TEST;
+}
+
+int UtcDaliAnimationSetSpeedFactorP3(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+  Stage::GetCurrent().Add(actor);
+
+  // Build the animation
+  float durationSeconds(1.0f);
+  Animation animation = Animation::New(durationSeconds);
+
+  const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
+  const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+
+  KeyFrames keyframes = KeyFrames::New();
+  keyframes.Add( 0.0f, initialPosition);
+  keyframes.Add( 1.0f, targetPosition );
+  animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+
+  bool signalReceived(false);
+  AnimationFinishCheck finishCheck(signalReceived);
+  animation.FinishedSignal().Connect(&application, finishCheck);
+
+  tet_printf("Test half speed factor. Animation will take twice the duration\n");
 
   //Set speed to be half of normal speed
   animation.SetSpeedFactor( 0.5f );
@@ -1327,8 +1378,62 @@ int UtcDaliAnimationSetSpeedFactorP(void)
   finishCheck.CheckSignalNotReceived();
   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
 
-  //Change speed factor while animation still playing.
-  animation.SetSpeedFactor(-1.0f);
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.4f), TEST_LOCATION );
+
+  application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
+
+  // We did expect the animation to finish
+  application.SendNotification();
+  finishCheck.CheckSignalReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
+
+  // Check that nothing has changed after a couple of buffer swaps
+  application.Render(0);
+  DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
+  application.Render(0);
+  DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
+  END_TEST;
+}
+
+
+int UtcDaliAnimationSetSpeedFactorP4(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+  Stage::GetCurrent().Add(actor);
+
+  // Build the animation
+  float durationSeconds(1.0f);
+  Animation animation = Animation::New(durationSeconds);
+
+  const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
+  const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+
+  KeyFrames keyframes = KeyFrames::New();
+  keyframes.Add( 0.0f, initialPosition);
+  keyframes.Add( 1.0f, targetPosition );
+  animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+
+  bool signalReceived(false);
+  AnimationFinishCheck finishCheck(signalReceived);
+  animation.FinishedSignal().Connect(&application, finishCheck);
+
+  tet_printf("Test half speed factor. Animation will take twice the duration\n");
+
+  tet_printf("Set speed to be half of normal speed\n");
+  tet_printf("SetSpeedFactor(0.5f)\n");
+  animation.SetSpeedFactor( 0.5f );
+
+  // Start the animation
+  animation.Play();
+
   application.SendNotification();
   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
 
@@ -1337,7 +1442,40 @@ int UtcDaliAnimationSetSpeedFactorP(void)
   finishCheck.CheckSignalNotReceived();
   DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), TEST_LOCATION );
 
-  application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond the animation duration*/);
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
+
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.3f), TEST_LOCATION );
+
+  tet_printf("Reverse direction of animation whilst playing\n");
+  tet_printf("SetSpeedFactor(-0.5f)\n");
+  animation.SetSpeedFactor(-0.5f);
+
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.2f), TEST_LOCATION );
+
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
+
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
 
   // We did expect the animation to finish
   application.SendNotification();
@@ -1352,6 +1490,352 @@ int UtcDaliAnimationSetSpeedFactorP(void)
   END_TEST;
 }
 
+int UtcDaliAnimationSetSpeedFactorAndRange(void)
+{
+  TestApplication application;
+
+  const unsigned int NUM_FRAMES(15);
+
+  struct TestData
+  {
+    float startTime;
+    float endTime;
+    float startX;
+    float endX;
+    float expected[NUM_FRAMES];
+  };
+
+  TestData testData[] = {
+    // ACTOR 0
+    /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
+    /*                       |----------PlayRange---------------|                 */
+    /*                                            | reverse                       */
+    { 0.0f,                                                                  1.0f, // TimePeriod
+      0.0f,                                                                100.0f, // POS
+      {/**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,  /* Loop */
+       /**/                 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
+       /**/                               50.0f,
+       /**/                        40.0f,
+       /**/                 30.0f,
+       /**/                                             70.0f,
+       /**/                                      60.0f,
+       /**/                               50.0f,
+       /**/
+      }
+    },
+
+    // ACTOR 1 - Across start of range
+    /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
+    /*                       |----------PlayRange---------------|                 */
+    /*                                            | reverse                       */
+    {                0.2f,                0.5f,                               // TimePeriod
+                     20.0f,               50.0f,                // POS
+      {/**/                 30.0f, 40.0f, 50.0f, 50.0f, 50.0f,  /* Loop */
+       /**/                 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
+       /**/                               50.0f,
+       /**/                        40.0f,
+       /**/                 30.0f,
+       /**/                                             50.0f,
+       /**/                                      50.0f,
+       /**/                               50.0f
+      }
+    },
+
+    // ACTOR 2 - Across end of range
+    /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
+    /*                       |----------PlayRange---------------|                 */
+    /*                                            | reverse                       */
+    {/**/                                  0.5f,                      0.9f,   // TimePeriod
+     /**/                                 50.0f,                      90.0f,  // POS
+     { /**/                 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
+       /**/                 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
+       /**/                               50.0f,
+       /**/                        50.0f,
+       /**/                 50.0f,                      70.0f,
+       /**/                                      60.0f,
+       /**/                               50.0f,
+      }
+    },
+
+    // ACTOR 3 - Before beginning of range
+    /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
+    /*                       |----------PlayRange---------------|                 */
+    /*                                            | reverse                       */
+    {/**/     0.1f,      0.25f, // TimePeriod
+     /**/     10.0f,     25.0f, // POS
+     { /**/
+       /**/ 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f
+       /**/
+      }
+    },
+
+    // ACTOR 4 - After end of range
+    /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
+    /*                       |----------PlayRange---------------|                 */
+    /*                                            | reverse                       */
+    {/**/                                                           0.85f,   1.0f, // TimePeriod
+     /**/                                                           85.0f,  100.0f, // POS
+     { /**/
+       /**/ 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f
+       /**/
+     }
+    },
+    // Actor 5 - Middle of range
+    /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
+    /*                       |----------PlayRange---------------|                 */
+    /*                                            | reverse                       */
+    {/**/                          0.4f,            0.65f, // Time Period
+     /**/                         40.0f,            65.0f, // Position
+     { /**/                40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
+       /**/                40.0f, 40.0f, 50.0f, 60.0f, // Reverse
+       /**/                              50.0f,
+       /**/                       40.0f,
+       /**/                40.0f,
+       /**/                                            65.0f,
+       /**/                                      60.0f,
+       /**/                              50.0f,
+     }
+    }
+  };
+
+  const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
+
+  // Build the animation
+  float durationSeconds(1.0f);
+  Animation animation = Animation::New(durationSeconds);
+  bool signalReceived(false);
+  AnimationFinishCheck finishCheck(signalReceived);
+  animation.FinishedSignal().Connect(&application, finishCheck);
+
+  std::vector<Dali::Actor> actors;
+
+  for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
+  {
+    Actor actor = Actor::New();
+    actor.SetPosition( Vector3( testData[actorIndex].startX, 0, 0 ) );
+    actors.push_back(actor);
+    Stage::GetCurrent().Add(actor);
+
+    if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
+    {
+      KeyFrames keyframes = KeyFrames::New();
+      keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
+      keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
+      animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+    }
+    else
+    {
+      animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
+    }
+  }
+
+  tet_printf("Test half speed factor. Animation will take twice the duration\n");
+  tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
+  tet_printf("SetSpeedFactor(0.5f)\n");
+  animation.SetSpeedFactor( 0.5f );
+  animation.SetPlayRange( Vector2(0.3f, 0.8f) );
+  animation.SetLooping(true);
+
+  // Start the animation
+  animation.Play();
+  application.SendNotification();
+  application.Render(0);   // Frame 0 tests initial values
+
+  for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
+  {
+    unsigned int actorIndex = 0u;
+    for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
+    {
+      DALI_TEST_EQUALS( actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
+      if( ! Equals(actors[actorIndex].GetCurrentPosition().x, testData[actorIndex].expected[frame]) )
+      {
+        tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
+      }
+    }
+
+    if( frame == 8 )
+    {
+      tet_printf("Reverse direction of animation whilst playing after frame 8\n");
+      tet_printf("SetSpeedFactor(-0.5f)\n");
+      animation.SetSpeedFactor(-0.5f);
+      application.SendNotification();
+    }
+    application.Render(200); // 200 ms at half speed corresponds to 0.1 s
+
+    // We didn't expect the animation to finish yet
+    application.SendNotification();
+    finishCheck.CheckSignalNotReceived();
+  }
+
+  END_TEST;
+}
+
+int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount01(void)
+{
+  TestApplication application;
+
+  const unsigned int NUM_FRAMES(15);
+
+  struct TestData
+  {
+    float startTime;
+    float endTime;
+    float startX;
+    float endX;
+    float expected[NUM_FRAMES];
+  };
+
+  TestData testData =
+    // ACTOR 0
+    /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
+    /*                       |----------PlayRange---------------|                 */
+    { 0.0f,                                                                  1.0f, // TimePeriod
+      0.0f,                                                                100.0f, // POS
+      {/**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,  /* Loop */
+       /**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
+       /**/                 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
+       /**/
+      }
+    };
+
+
+  // Build the animation
+  float durationSeconds(1.0f);
+  Animation animation = Animation::New(durationSeconds);
+  bool signalReceived(false);
+  AnimationFinishCheck finishCheck(signalReceived);
+  animation.FinishedSignal().Connect(&application, finishCheck);
+
+  std::vector<Dali::Actor> actors;
+
+  Actor actor = Actor::New();
+  actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
+  actors.push_back(actor);
+  Stage::GetCurrent().Add(actor);
+
+  KeyFrames keyframes = KeyFrames::New();
+  keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
+  keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
+  animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+
+  tet_printf("Test half speed factor. Animation will take twice the duration\n");
+  tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
+  tet_printf("SetSpeedFactor(0.5f)\n");
+  tet_printf("SetLoopCount(3)\n");
+  animation.SetSpeedFactor( 0.5f );
+  animation.SetPlayRange( Vector2(0.3f, 0.8f) );
+  animation.SetLoopCount(3);
+
+  // Start the animation
+  animation.Play();
+  application.SendNotification();
+  application.Render(0);   // Frame 0 tests initial values
+
+  for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
+  {
+    DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
+
+    application.Render(200); // 200 ms at half speed corresponds to 0.1 s
+
+    if( frame < NUM_FRAMES-1 )
+    {
+      // We didn't expect the animation to finish yet
+      application.SendNotification();
+      finishCheck.CheckSignalNotReceived();
+    }
+  }
+
+  // We did expect the animation to finish
+  application.SendNotification();
+  finishCheck.CheckSignalReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 80.0f, 0.001, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliAnimationSetSpeedFactorRangeAndLoopCount02(void)
+{
+  TestApplication application;
+
+  const unsigned int NUM_FRAMES(15);
+
+  struct TestData
+  {
+    float startTime;
+    float endTime;
+    float startX;
+    float endX;
+    float expected[NUM_FRAMES];
+  };
+
+  TestData testData =
+    // ACTOR 0
+    /*0.0f,   0.1f   0.2f   0.3f   0.4f   0.5f   0.6f   0.7f   0.8f   0.9f   1.0f */
+    /*                       |----------PlayRange---------------|                 */
+    { 0.0f,                                                                  1.0f, // TimePeriod
+      0.0f,                                                                100.0f, // POS
+      {/**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
+       /**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
+       /**/                 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
+      }
+    };
+
+
+  // Build the animation
+  float durationSeconds(1.0f);
+  Animation animation = Animation::New(durationSeconds);
+  bool signalReceived(false);
+  AnimationFinishCheck finishCheck(signalReceived);
+  animation.FinishedSignal().Connect(&application, finishCheck);
+
+  std::vector<Dali::Actor> actors;
+
+  Actor actor = Actor::New();
+  actor.SetPosition( Vector3( testData.startX, 0, 0 ) );
+  actors.push_back(actor);
+  Stage::GetCurrent().Add(actor);
+
+  KeyFrames keyframes = KeyFrames::New();
+  keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
+  keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
+  animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+
+  tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
+  tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
+  tet_printf("SetSpeedFactor(-0.5f)\n");
+  tet_printf("SetLoopCount(3)\n");
+  animation.SetSpeedFactor( -0.5f );
+  animation.SetPlayRange( Vector2(0.3f, 0.8f) );
+  animation.SetLoopCount(3);
+
+  // Start the animation
+  animation.Play();
+  application.SendNotification();
+  application.Render(0);   // Frame 0 tests initial values
+
+  for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
+  {
+    DALI_TEST_EQUALS( actor.GetCurrentPosition().x, testData.expected[frame], 0.001, TEST_LOCATION );
+
+    application.Render(200); // 200 ms at half speed corresponds to 0.1 s
+
+    if( frame < NUM_FRAMES-1 )
+    {
+      // We didn't expect the animation to finish yet
+      application.SendNotification();
+      finishCheck.CheckSignalNotReceived();
+    }
+  }
+
+  // We did expect the animation to finish
+  application.SendNotification();
+  finishCheck.CheckSignalReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition().x, 30.0f, 0.001, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
 int UtcDaliAnimationGetSpeedFactorP(void)
 {
   TestApplication application;
index d3ba046..bb9db7c 100755 (executable)
@@ -47,7 +47,18 @@ my @system_packages = (
     "libharfbuzz-dev",
     "doxygen",
     "lcov",
-    "libcurl4-gnutls-dev"
+    "libcurl4-gnutls-dev",
+);
+
+my @emscripten_system_packages = (
+    "gnome-common",
+    "curl",
+    "tar",
+    "build-essential",
+    "cmake",
+    "nodejs",
+    "default-jre",
+    "python2.7"
 );
 
 # Some packages like require building from source
@@ -62,7 +73,11 @@ my @source_pkgs = (
 
      # original version used with DALi is 3.25.19. 3.32.7 is the latest we can use before
      # upgrading DALi to use  c++0x or c++11
-     "version" => " 3.32.7", "make" => "make -j8 library=shared", "build-mode" =>"debug" }
+     "version" => " 3.32.7", "make" => "make -j8 library=shared", "build-mode" =>"debug" },
+
+    {"name" => "emscripten",
+     "portable" => "https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz"
+    }
 );
 
 ### Detect any http proxy, part of v8 installation requires this information
@@ -129,17 +144,20 @@ else
     }
 }
 
-my $src_path     = "$root_path/src-packages";
-my $sbs_path     = "$root_path/target";
-my $install_path = "$root_path/opt";
+my $src_path         = "$root_path/src-packages";
+my $sbs_path         = "$root_path/target";
+my $install_path     = "$root_path/opt";
+my $emscripten_path  = "$root_path/emsdk_portable";
 
 my $opt_create=0;
 my $opt_setenv=0;
 my $opt_help=0;
 my $opt_man=0;
+my $opt_emscripten=0;
 
 GetOptions("create"     => \$opt_create,
            "setenv"     => \$opt_setenv,
+           "emscripten" => \$opt_emscripten,
            "help"       => \$opt_help,
            "man"        => \$opt_man) or pod2usage(2);
 
@@ -175,7 +193,25 @@ sub in_dali_env
 
 sub create_setenv
 {
+    if( ( -d $emscripten_path ) || $opt_emscripten )
+    {
+        print <<"EOF";
+#
+# Emscripten environment
+#  - which brazenly overwrites PATH so we set this first
+#  - NB: If you change the tools within emsdk then you'll need to recreate this file
+#
+
+EOF
+        my $emsdk_env_file = $emscripten_path . '/emsdk_set_env.sh';
+        open(FILE, $emsdk_env_file) or die "Can't read file enscripten env file" . $emsdk_env_file;
+        my @emsdk_env = <FILE>;
+        close (FILE);
+        print @emsdk_env;
+    }
+
     print <<"EOF";
+#
 # To use the desktop libraries, please add the following lines to your .bashrc or
 # create a setenv script from them, e.g. by running this command as follows
 # \$ $install_path/bin/dali_env -s > setenv
@@ -206,7 +242,7 @@ sub check_system_package
         if($x[0] ne "ii")
         {
             print "Attempting to install $package\n";
-            system("sudo apt-get -y install $package");
+            system("sudo apt-get -y --force-yes install $package");
         }
     }
 }
@@ -216,6 +252,12 @@ sub check_system_packages
     print "Checking for required system packages (may require sudo password)\n";
 
     check_system_package(@system_packages);
+
+    if($opt_emscripten)
+    {
+        check_system_package(@emscripten_system_packages);
+    }
+
     my $gnome_v =`dpkg -l gnome-common| tail -1| sed "s/ \\+/ /g" | cut -d' ' -f 3`;
     my @am = split(/\./, `automake --version | head -1 | cut -f4 -d' '`);
     if($gnome_v =~ /$2.24/ && $am[1]>10)
@@ -245,6 +287,10 @@ sub check_source_packages
         {
             install_v8( $pkgref );
         }
+        elsif($pkg eq "emscripten" && $opt_emscripten)
+        {
+            install_emscripten( $pkgref );
+        }
     }
 }
 
@@ -363,7 +409,7 @@ sub install_v8
 {
     my $v8 = $_[0];
     my $ret;
-    my $v8Version = $v8->{"version"} ;
+    my $v8Version = $v8->{"version"};
     print( "Checking if V8 ". $v8Version. " is installed \n");
 
 ####
@@ -527,6 +573,61 @@ END
 
 }
 
+################################################################################
+#
+# install the latest emscripten in a portable directory
+#
+################################################################################
+sub install_emscripten
+{
+    my $info = $_[0];
+    my $ret;
+    print( "Checking if Emscripten is up to date\n");
+
+    my $portable = $info->{"portable"};
+
+    my $current_dir = getcwd();
+
+    print( "\n");
+    print( "Installing or updating Emscripten.\n");
+    print( ".....You may need a cup of tea.\n");
+    print( ".......... In fact, take the afternoon off.\n");
+    print( "\n");
+
+    if(-e $emscripten_path)
+    {
+        chdir( $emscripten_path );
+    }
+    else
+    {
+        chdir( $root_path );
+
+        system("curl -O " . $portable) == 0
+            or die "curl failed with error $?. :" . $portable;
+
+        my($filename, $dirs, $suffix) = fileparse($portable);
+
+        system("tar -xvf " . $filename . $suffix) == 0
+            or die "tar unpack failed (nb tar.gz is the presumed downloaded format):" . $filename . $suffix;
+
+        system("rm " . $filename . $suffix) == 0
+            or die "Cannot remove emsdk portable tar file:" . $filename . $suffix;
+
+        chdir( $emscripten_path );
+    }
+
+    system("./emsdk update") == 0
+        or die "Cannot run emsdk? Did the install fail?";
+
+    system("./emsdk install latest");
+    system("./emsdk activate latest");
+    system("bash -c \"source ./emsdk_env.sh\""); # emsdk uses popd ie expects bash
+
+    system("emsdk list");
+
+    chdir($current_dir);
+}
+
 
 ################################################################################
 #                                       MAIN
@@ -601,6 +702,10 @@ Create a DALi environment directory in the current directory.
 
 Display environment variables to setup.
 
+=item B<-e|--emscripten>
+
+Include emscripten (use with -c to install with emscripten or -s to setup env vars with emscripten).
+
 =item B<-h|--help>
 
 Display this help
index b8914d6..86e057b 100644 (file)
@@ -49,15 +49,11 @@ ContextNotifierInterface* Core::GetContextNotifier()
   return mImpl->GetContextNotifier();
 }
 
-// @todo Rename to ResetGlContext
 void Core::ContextCreated()
 {
   mImpl->ContextCreated();
 }
 
-// @todo Replace with StopRendering that prevents RenderManager from rendering
-// until we get ResetGLContext again, change ContextCreated to reset gpu buffer cache,
-// gl texture id's
 void Core::ContextDestroyed()
 {
   mImpl->ContextDestroyed();
index 3697fa1..db8bebb 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTEGRATION_PLATFORM_ABSTRACTION_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -21,7 +21,7 @@
 // INTERNAL INCLUDES
 
 #include <dali/integration-api/resource-cache.h>
-#include <dali/integration-api/bitmap.h> ///@todo Remove this include (a bunch of stuff needs to include it though)
+#include <dali/integration-api/bitmap.h>
 #include <dali/public-api/images/image-operations.h>
 #include <dali/public-api/common/dali-vector.h>
 
index 869bcfc..9e89789 100644 (file)
@@ -97,7 +97,6 @@ unsigned int* MessageBuffer::ReserveMessageSlot( std::size_t size )
   // End marker
   *mNextSlot = 0;
 
-  // @todo Remove cast & change all messages to use WordType instead
   return reinterpret_cast<unsigned int*>(slot);
 }
 
index bba814f..548389c 100644 (file)
@@ -103,7 +103,6 @@ bool KeyFrameChannel<V>::IsActive (float progress)
 
 /**
  * Use a linear search to find the interval containing progress
- * TODO: Use binary search instead
  */
 template <class V>
 bool KeyFrameChannel<V>::FindInterval(
index cc574ff..c593b0b 100644 (file)
@@ -129,7 +129,6 @@ protected:
  * The base template class for each key frame specialization. It stores a vector of
  * ProgressValue pairs in mPVs, and uses the existing interface for KeyFrameChannel
  * to point at this vector.
- * TODO: Incorporate KeyFrameChannel into this base template
  */
 template<typename V>
 class KeyFrameBaseSpec : public KeyFrameSpec
@@ -202,7 +201,6 @@ public:
    */
   void AddKeyFrame(float t, V v, AlphaFunction alpha)
   {
-    // TODO:: Support alpha
     mPVs.push_back(PV(t, v));
   }
 
index 8c25056..3d7b09e 100644 (file)
@@ -99,10 +99,6 @@ struct ObjectImplHelper
   {
     Property::Index index = Property::INVALID_INDEX;
 
-    //@todo MESH_REWORK - Are we assuming that the index into the array is the
-    // same as the enumerated property? if enumIndex in the table was no longer
-    // debug only, wouldn't need to make this assumption.
-
     // Look for name in default properties
     for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
     {
index d000227..7013a10 100644 (file)
@@ -783,8 +783,6 @@ void Object::AddUniformMapping( Property::Index propertyIndex, const std::string
     }
   }
 
-  // @todo MESH_REWORK Store mappings for unstaged objects?
-
   if( propertyPtr != NULL )
   {
     const SceneGraph::PropertyOwner* sceneObject = GetPropertyOwner();
@@ -797,8 +795,6 @@ void Object::AddUniformMapping( Property::Index propertyIndex, const std::string
     }
     else
     {
-      // @todo MESH_REWORK FIXME Need to store something that can be sent to the scene
-      // object when staged.
       DALI_ASSERT_ALWAYS(0 && "MESH_REWORK - Need to store property whilst off-stage" );
     }
   }
index f4ae6a6..1f5ade8 100644 (file)
@@ -115,7 +115,6 @@ ShaderPtr Shader::New( const std::string& vertexShader,
                        const std::string& fragmentShader,
                        Dali::Shader::ShaderHints hints )
 {
-  //TODO: MESH_REWORK
   ShaderPtr shader( new Shader() );
   shader->Initialize( vertexShader, fragmentShader, hints );
   return shader;
index cfe5728..a98fd53 100644 (file)
@@ -131,7 +131,7 @@ private:
   // Undefined
   RenderInstruction& operator=(const RenderInstruction& rhs);
 
-public: // Data, TODO hide these
+public: // Data
 
   Render::RenderTracker* mRenderTracker;        ///< Pointer to an optional tracker object (not owned)
 
index ce16412..a586036 100644 (file)
@@ -199,9 +199,6 @@ void RenderManager::ContextCreated()
 
 void RenderManager::ContextDestroyed()
 {
-  // @todo Set an atomic value to prevent render manager rendering again until
-  // ContextCreated has been called.
-
   mImpl->context.GlContextDestroyed();
   mImpl->programController.GlContextDestroyed();
 
index ef8a0ed..d73f70c 100644 (file)
@@ -42,8 +42,6 @@ class Shader;
  * the current render. It essentially provides double buffering of the
  * provider accessor through the message system. It does not take ownership
  * of any objects.
- *
- * @todo - Add set of bools to state what changed (For improving performance)
  */
 class RenderDataProvider
 {
index 877010c..1cf77e5 100644 (file)
@@ -32,13 +32,13 @@ Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::Animation>
 
 inline void WrapInPlayRange( float& elapsed, const Dali::Vector2& playRangeSeconds)
 {
-  if (elapsed > playRangeSeconds.y )
+  ifelapsed > playRangeSeconds.y )
   {
-    elapsed = playRangeSeconds.x + fmod(elapsed, playRangeSeconds.y);
+    elapsed = playRangeSeconds.x + fmodf((elapsed-playRangeSeconds.x), (playRangeSeconds.y-playRangeSeconds.x));
   }
   else if( elapsed < playRangeSeconds.x )
   {
-    elapsed = playRangeSeconds.y - fmod(elapsed, playRangeSeconds.y);
+    elapsed = playRangeSeconds.y - fmodf( (playRangeSeconds.x - elapsed), (playRangeSeconds.y-playRangeSeconds.x) );
   }
 }
 
@@ -114,8 +114,20 @@ void Animation::SetPlayRange( const Vector2& range )
 {
   mPlayRange = range;
 
-  //Make sure mElapsedSeconds is within the new range
-  mElapsedSeconds = Dali::Clamp(mElapsedSeconds, mPlayRange.x*mDurationSeconds , mPlayRange.y*mDurationSeconds );
+  // Make sure mElapsedSeconds is within the new range
+
+  if( mState == Stopped )
+  {
+    // Ensure that the animation starts at the right place
+    mElapsedSeconds = mPlayRange.x * mDurationSeconds;
+  }
+  else
+  {
+    // If already past the end of the range, but before end of duration, then clamp will
+    // ensure that the animation stops on the next update.
+    // If not yet at the start of the range, clamping will jump to the start
+    mElapsedSeconds = Dali::Clamp(mElapsedSeconds, mPlayRange.x*mDurationSeconds , mPlayRange.y*mDurationSeconds );
+  }
 }
 
 void Animation::Play()
@@ -134,7 +146,8 @@ void Animation::Play()
 
 void Animation::PlayFrom( float progress )
 {
-  //If the animation is already playing this has no effect
+  // If the animation is already playing this has no effect
+  // Progress is guaranteed to be in range.
   if( mState != Playing )
   {
     mElapsedSeconds = progress * mDurationSeconds;
@@ -269,7 +282,7 @@ void Animation::Update(BufferIndex bufferIndex, float elapsedSeconds, bool& loop
                (( mSpeedFactor > 0.0f && mElapsedSeconds > playRangeSeconds.y )  ||
                 ( mSpeedFactor < 0.0f && mElapsedSeconds < playRangeSeconds.x )) );
 
-    WrapInPlayRange(mElapsedSeconds, playRangeSeconds);
+    WrapInPlayRange( mElapsedSeconds, playRangeSeconds );
 
     UpdateAnimators(bufferIndex, false, false);
 
@@ -305,12 +318,12 @@ void Animation::Update(BufferIndex bufferIndex, float elapsedSeconds, bool& loop
       mState = Stopped;
     }
   }
-
 }
 
 void Animation::UpdateAnimators( BufferIndex bufferIndex, bool bake, bool animationFinished )
 {
-  float elapsedSecondsClamped = Clamp( mElapsedSeconds, mPlayRange.x * mDurationSeconds,mPlayRange.y * mDurationSeconds );
+  const Vector2 playRange( mPlayRange * mDurationSeconds );
+  float elapsedSecondsClamped = Clamp( mElapsedSeconds, playRange.x, playRange.y );
 
   //Loop through all animators
   bool applied(true);
@@ -327,8 +340,8 @@ void Animation::UpdateAnimators( BufferIndex bufferIndex, bool bake, bool animat
     {
       if( animator->IsEnabled() )
       {
-        const float initialDelay(animator->GetInitialDelay());
-        if (elapsedSecondsClamped >= initialDelay || mSpeedFactor < 0.0f )
+        const float initialDelay( animator->GetInitialDelay() );
+        if( elapsedSecondsClamped >= initialDelay )
         {
           // Calculate a progress specific to each individual animator
           float progress(1.0f);
index a1400e5..9d4fa6f 100644 (file)
@@ -70,10 +70,6 @@ void UniformMap::MappingChanged()
   }
 }
 
-// @todo MESH_REWORK Benchmark and test
-// The uniform map can never grow beyond the limits of GL - so really, the
-// map size is likely to be small; if retaining an unsorted map proves to be
-// slow, then it should be changed to perform an insertion sort.
 void UniformMap::Add( UniformPropertyMapping* newMap )
 {
   UniformPropertyMapping::Hash nameHash = CalculateHash( newMap->uniformName );
index dbaa37e..8a6a594 100644 (file)
@@ -201,8 +201,6 @@ inline bool TryReuseCachedRenderers( Layer& layer,
  */
 bool CompareItems( const RendererWithSortAttributes& lhs, const RendererWithSortAttributes& rhs )
 {
-  // @todo MESH_REWORK Consider replacing all these sortAttributes with a single long int that
-  // encapsulates the same data (e.g. the middle-order bits of the ptrs)
   if( lhs.renderItem->GetDepthIndex() == rhs.renderItem->GetDepthIndex() )
   {
     if( lhs.shader == rhs.shader )
index 0d79152..acb1b4d 100644 (file)
@@ -84,7 +84,6 @@ void AddMappings( Dali::Internal::SceneGraph::CollectedUniformMap& localMap, con
       const Dali::Internal::SceneGraph::UniformPropertyMapping* map = (*iter);
       localMap.PushBack( map );
     }
-    //@todo MESH_REWORK Use memcpy to copy ptrs from one array to the other
   }
 }
 
index b201f2a..9339bbb 100644 (file)
@@ -28,7 +28,7 @@ namespace Dali
 
 const unsigned int CORE_MAJOR_VERSION = 1;
 const unsigned int CORE_MINOR_VERSION = 1;
-const unsigned int CORE_MICRO_VERSION = 22;
+const unsigned int CORE_MICRO_VERSION = 23;
 const char * const CORE_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifndef EMSCRIPTEN
index d8c09e0..f91ec29 100644 (file)
@@ -54,7 +54,6 @@ ShaderEffect& ShaderEffect::operator=(const ShaderEffect& rhs)
 
 ShaderEffect ShaderEffect::New( const std::string& vertexShader, const std::string& fragmentShader, GeometryHints hints)
 {
-  // @todo MESH_REWORK - Assert only image geometry type is passed.
   Internal::ShaderEffectPtr internal = Internal::ShaderEffect::New( hints );
 
   internal->SetPrograms( vertexShader, fragmentShader );
@@ -68,7 +67,6 @@ ShaderEffect ShaderEffect::NewWithPrefix( const std::string& vertexShaderPrefix,
                                           const std::string& fragmentShader,
                                           GeometryHints hints)
 {
-  // @todo MESH_REWORK - Assert only image geometry type is passed.
   Internal::ShaderEffectPtr internal = Internal::ShaderEffect::New( hints );
 
   internal->SetPrograms( vertexShaderPrefix, fragmentShaderPrefix, vertexShader, fragmentShader );
index 6401c2c..745b800 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali
 Summary:    The OpenGLES Canvas Core Library
-Version:    1.1.22
+Version:    1.1.23
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-2-Clause and MIT