From: Francisco Santos Date: Fri, 19 May 2017 12:43:54 +0000 (+0100) Subject: [dali_1.2.40] Merge branch 'devel/master' X-Git-Tag: submit/trunk/20181001.110911~69 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=091424324901c46a18959bfc0dd52f7ce8a0a811;hp=cf70a56a2d77c517c30f66bd9eb5a6144b774227;p=platform%2Fcore%2Fuifw%2Fdali-core.git [dali_1.2.40] Merge branch 'devel/master' Change-Id: I8d45353a19b8f0ae86be178a2325a04e0b8beab1 --- diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index f4a6071..4794369 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -5960,6 +5960,7 @@ int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void) END_TEST; } + int utcDaliActorVisibilityChangeSignalSelf(void) { TestApplication application; @@ -6042,4 +6043,43 @@ int utcDaliActorVisibilityChangeSignalChildren(void) childData.Check( false /* not called */, TEST_LOCATION ); grandChildData.Check( false /* not called */, TEST_LOCATION ); - END_TEST;} + END_TEST; +} + +int utcDaliActorVisibilityChangeSignalAfterAnimation(void) +{ + TestApplication application; + tet_infoline( "Check that the visibility change signal is emitted when the visibility changes when an animation starts" ); + + Actor actor = Actor::New(); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + VisibilityChangedFunctorData data; + DevelActor::VisibilityChangedSignal( actor ).Connect( &application, VisibilityChangedFunctor( data ) ); + + Animation animation = Animation::New( 1.0f ); + animation.AnimateTo( Property( actor, Actor::Property::VISIBLE ), false ); + + data.Check( false, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< bool >( actor, Actor::Property::VISIBLE ), true, TEST_LOCATION ); + + tet_infoline( "Play the animation and check the property value" ); + animation.Play(); + + data.Check( true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); + + tet_infoline( "Animation not currently finished, so the current visibility should still be true" ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< bool >( actor, Actor::Property::VISIBLE ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render( 1100 ); // After the animation + + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< bool >( actor, Actor::Property::VISIBLE ), false, TEST_LOCATION ); + + END_TEST; +} diff --git a/automated-tests/src/dali/utc-Dali-Animation.cpp b/automated-tests/src/dali/utc-Dali-Animation.cpp index 1565169..980c108 100644 --- a/automated-tests/src/dali/utc-Dali-Animation.cpp +++ b/automated-tests/src/dali/utc-Dali-Animation.cpp @@ -5781,10 +5781,11 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void) application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); - // We didn't expect the animation to finish yet + // We didn't expect the animation to finish yet, but cached value should be the final one application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -5801,6 +5802,7 @@ int UtcDaliAnimationAnimateToVector2AlphaFunctionTimePeriodP(void) application.SendNotification(); finishCheck.CheckSignalReceived(); DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( actor, index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -6518,9 +6520,21 @@ int UtcDaliAnimationAnimateToActorSizeP(void) Vector3 ninetyNinePercentProgress(targetSize * 0.99f); + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION ); + // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -6628,9 +6642,17 @@ int UtcDaliAnimationAnimateToActorSizeWidthP(void) float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f); + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION ); + // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -6672,9 +6694,17 @@ int UtcDaliAnimationAnimateToActorSizeHeightP(void) float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f); + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION ); + // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -6716,9 +6746,17 @@ int UtcDaliAnimationAnimateToActorSizeDepthP(void) float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f); + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION ); + // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -6868,9 +6906,21 @@ int UtcDaliAnimationAnimateToActorPositionP(void) Vector3 seventyFivePercentProgress(targetPosition * 0.75f); + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION ); + // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -6913,9 +6963,17 @@ int UtcDaliAnimationAnimateToActorPositionXP(void) float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f); + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION ); + // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -6961,9 +7019,17 @@ int UtcDaliAnimationAnimateToActorPositionYP(void) float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f); + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION ); + // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -7009,9 +7075,17 @@ int UtcDaliAnimationAnimateToActorPositionZP(void) float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f); + // Should return the initial properties before play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION ); + // Start the animation animation.Play(); + // Should return the target property after play + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -7210,6 +7284,9 @@ int UtcDaliAnimationAnimateToActorOrientationAngleAxisP(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -7504,6 +7581,12 @@ int UtcDaliAnimationAnimateToActorScaleP(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -7619,6 +7702,10 @@ int UtcDaliAnimationAnimateToActorScaleXP(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -7673,6 +7760,10 @@ int UtcDaliAnimationAnimateToActorScaleYP(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -7727,6 +7818,10 @@ int UtcDaliAnimationAnimateToActorScaleZP(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -7775,6 +7870,14 @@ int UtcDaliAnimationAnimateToActorColorP(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetColor.a, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -7900,6 +8003,10 @@ int UtcDaliAnimationAnimateToActorColorRedP(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -7958,6 +8065,10 @@ int UtcDaliAnimationAnimateToActorColorGreenP(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -8016,6 +8127,10 @@ int UtcDaliAnimationAnimateToActorColorBlueP(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -8074,6 +8189,11 @@ int UtcDaliAnimationAnimateToActorColorAlphaP(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( DevelActor::Property::OPACITY ), targetAlpha, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -10085,10 +10205,11 @@ int UtcDaliAnimationExtendDurationP(void) application.SendNotification(); application.Render(static_cast(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */); - // We didn't expect the animation to finish yet + // We didn't expect the animation to finish yet, but cached value should be the final one application.SendNotification(); finishCheck.CheckSignalNotReceived(); - DALI_TEST_EQUALS( actor.GetProperty(index), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */); @@ -10105,6 +10226,7 @@ int UtcDaliAnimationExtendDurationP(void) application.SendNotification(); finishCheck.CheckSignalReceived(); DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, index ), targetValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION ); END_TEST; } @@ -10118,6 +10240,7 @@ int UtcDaliAnimationCustomIntProperty(void) Property::Index index = actor.RegisterProperty("anIndex", startValue); DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), startValue, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION ); // Build the animation float durationSeconds(1.0f); @@ -10127,6 +10250,9 @@ int UtcDaliAnimationCustomIntProperty(void) // Start the animation animation.Play(); + // Target value should be retrievable straight away + DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION ); + bool signalReceived(false); AnimationFinishCheck finishCheck(signalReceived); animation.FinishedSignal().Connect(&application, finishCheck); @@ -10146,6 +10272,7 @@ int UtcDaliAnimationCustomIntProperty(void) application.SendNotification(); finishCheck.CheckSignalReceived(); DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< int >( actor, index ), 20, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION ); END_TEST; } @@ -10475,7 +10602,7 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionCol // Build the animation Animation animation = Animation::New(2.0f); - tet_infoline("Set target size in animation without intiating play"); + tet_infoline("Set target size in animation without initiating play"); animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSizes[0], AlphaFunction::LINEAR); tet_infoline("Set target position in animation without intiating play"); animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetColors[0], AlphaFunction::LINEAR); @@ -10484,7 +10611,7 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionCol application.SendNotification(); application.Render(); - tet_infoline("Ensure position of actor is still at intial size and position"); + tet_infoline("Ensure position of actor is still at initial size and position"); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION ); @@ -10496,7 +10623,7 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionCol application.SendNotification(); application.Render(2000u); - tet_infoline("Ensure position and size of actor is at target value when aninmation playing"); + tet_infoline("Ensure position and size of actor is at target value when animation playing"); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION ); DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION ); @@ -10506,3 +10633,156 @@ int UtcDaliAnimationSetAndGetTargetBeforePlayMulitpleAnimatorsSizeAndPositionCol END_TEST; } + +int UtcDaliAnimationTimePeriodOrder(void) +{ + tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" ); + + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + + ////////////////////////////////////////////////////////////////////////////////// + + tet_infoline( "With two AnimateTo calls" ); + + Animation animation = Animation::New( 0.0f ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) ); + animation.Play(); + + tet_infoline( "The target position should change instantly" ); + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(5000); // After the animation is complete + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION ); + + ////////////////////////////////////////////////////////////////////////////////// + + tet_infoline( "Same animation again but in a different order - should yield the same result" ); + + actor.SetX( 0.0f ); + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + + animation = Animation::New( 0.0f ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) ); + animation.Play(); + + tet_infoline( "The target position should change instantly" ); + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(5000); // After the animation is complete + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void) +{ + tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls" ); + + TestApplication application; + + Actor actor = Actor::New(); + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + + ////////////////////////////////////////////////////////////////////////////////// + + tet_infoline( "" ); + + Animation animation = Animation::New( 0.0f ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) ); + animation.Play(); + + tet_infoline( "The target position should change instantly" ); + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(14000); // After the animation is complete + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION ); + + ////////////////////////////////////////////////////////////////////////////////// + + tet_infoline( "Same animation again but in a different order - should end up at the same point" ); + + actor.SetX( 0.0f ); + + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION ); + + animation = Animation::New( 0.0f ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) ); + animation.Play(); + + tet_infoline( "The target position should change instantly" ); + DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION ); + + application.SendNotification(); + application.Render(14000); // After the animation is complete + + DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector3 >( actor, Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( actor, Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION ); + + END_TEST; +} diff --git a/automated-tests/src/dali/utc-Dali-Constrainer.cpp b/automated-tests/src/dali/utc-Dali-Constrainer.cpp index e212720..33e6ec9 100644 --- a/automated-tests/src/dali/utc-Dali-Constrainer.cpp +++ b/automated-tests/src/dali/utc-Dali-Constrainer.cpp @@ -189,14 +189,14 @@ int UtcPathConstrainerApplyRange(void) Vector3 position, tangent; float tValue; - actor.GetProperty(index).Get(tValue); + DevelHandle::GetCurrentProperty( actor, index ).Get(tValue); float currentCursor = ( tValue - range.x ) / (range.y-range.x); path.Sample(currentCursor, position, tangent ); DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*250.0f)/* 50% progress */); - actor.GetProperty(index).Get(tValue); + DevelHandle::GetCurrentProperty( actor, index ).Get(tValue); currentCursor = ( tValue - range.x ) / (range.y-range.x); path.Sample(currentCursor, position, tangent ); path.Sample(0.5, position, tangent ); @@ -223,6 +223,12 @@ int UtcPathConstrainerApplyRange(void) path.Sample(currentCursor, position, tangent ); DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION ); + // Ensure GetProperty also returns the final result + actor.GetProperty( index ).Get( tValue ); + currentCursor = ( tValue - range.x ) / (range.y-range.x); + path.Sample(currentCursor, position, tangent ); + DALI_TEST_EQUALS( actor.GetCurrentPosition(), position, TEST_LOCATION ); + END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Handle.cpp b/automated-tests/src/dali/utc-Dali-Handle.cpp index f66177b..874b936 100644 --- a/automated-tests/src/dali/utc-Dali-Handle.cpp +++ b/automated-tests/src/dali/utc-Dali-Handle.cpp @@ -896,9 +896,36 @@ int UtcDaliHandleWeightNew(void) { TestApplication application; - Handle handle = WeightObject::New();; + Handle handle = WeightObject::New(); DALI_TEST_CHECK( handle.GetProperty(WeightObject::WEIGHT) == 0.0f ); + // process the message so scene object is added to update manager + application.SendNotification(); + application.Render(0); + + // no message to release scene object in this scenario + + END_TEST; +} + +int UtcDaliHandleWeightNew2(void) +{ + TestApplication application; + + // scope for the weight object + { + Handle handle = WeightObject::New(); + DALI_TEST_CHECK( handle.GetProperty(WeightObject::WEIGHT) == 0.0f ); + + // process the message so scene object is added to update manager + application.SendNotification(); + application.Render(0); + } + // handle out of scope so object gets destroyed + // process the message so update manager destroys the scene object + application.SendNotification(); + application.Render(0); + END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-RenderTask.cpp b/automated-tests/src/dali/utc-Dali-RenderTask.cpp index 061cb62..7e9ad26 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -1431,9 +1431,14 @@ int UtcDaliRenderTaskSetViewportPosition(void) animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition3, AlphaFunction::LINEAR ); animation.Play(); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION ); + // Perform 1000ms worth of updates at which point animation should have completed. Wait(application, 1000); DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); END_TEST; } @@ -1483,9 +1488,14 @@ int UtcDaliRenderTaskSetViewportSize(void) animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_SIZE ), newSize3, AlphaFunction::LINEAR ); animation.Play(); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION ); + // Perform 1000ms worth of updates at which point animation should have completed. Wait(application, 1000); DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector2 >( task, RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); END_TEST; } @@ -1521,6 +1531,20 @@ int UtcDaliRenderTaskSetClearColorP(void) DALI_TEST_EQUALS( task.GetClearColor(), testColor2, TEST_LOCATION ); DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( task, RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); + + Vector4 newColor3(10.0f, 10.0f, 20.0f, 30.0f); + Animation animation = Animation::New(1.0f); + animation.AnimateTo( Property( task, RenderTask::Property::CLEAR_COLOR ), newColor3, AlphaFunction::LINEAR ); + animation.Play(); + + DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( task, RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION ); + + // Perform 1000ms worth of updates at which point animation should have completed. + Wait(application, 1000); + DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< Vector4 >( task, RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION ); + END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp index 1e89b06..41ba9b9 100644 --- a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp +++ b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp @@ -1179,11 +1179,16 @@ int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void) Animation animation = Animation::New(0.2f); animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 15.f, AlphaFunction::LINEAR ); animation.Play(); + + // Target value should change straight away + DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 15.0f, TEST_LOCATION ); + // Render and notify, animation play for 0.05 seconds application.SendNotification(); application.Render(50); DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION ); DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 22.5f, TEST_LOCATION ); + // Render and notify, animation play for another 0.1 seconds application.SendNotification(); application.Render(100); @@ -1280,11 +1285,16 @@ int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void) Animation animation = Animation::New(0.2f); animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR ); animation.Play(); + + // Target value should change straight away + DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 20.0f, TEST_LOCATION ); + // Render and notify, animation play for 0.05 seconds application.SendNotification(); application.Render(50); DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION ); DALI_TEST_EQUALS( DevelHandle::GetCurrentProperty< float >( customActor, animatablePropertyIndex ), 12.5f, TEST_LOCATION ); + // Render and notify, animation play for another 0.1 seconds application.SendNotification(); application.Render(100); diff --git a/build/tizen/configure.ac b/build/tizen/configure.ac index bebc98a..ca4dd8e 100644 --- a/build/tizen/configure.ac +++ b/build/tizen/configure.ac @@ -30,6 +30,9 @@ AC_SUBST(DALI_VERSION) DALI_CFLAGS=-DPLATFORM_TIZEN +# Use C++ 11 +DALI_CFLAGS="$DALI_CFLAGS -std=c++11 -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast" + AC_ARG_ENABLE(exportall, [AC_HELP_STRING([--enable-exportall], [enables the exporting of all the symbols in the library])], diff --git a/build/tizen/dali-core.pc.in b/build/tizen/dali-core.pc.in index 429a595..9c5eb39 100644 --- a/build/tizen/dali-core.pc.in +++ b/build/tizen/dali-core.pc.in @@ -9,4 +9,4 @@ Description: 3D Canvas Toolkit using OpenGLES Version: ${apiversion} Requires: Libs: -L${libdir} -ldali-core -Cflags: -I${includedir} +Cflags: -I${includedir} -std=c++11 diff --git a/dali/devel-api/common/owner-container.h b/dali/devel-api/common/owner-container.h index 3ac0df2..f35b278 100644 --- a/dali/devel-api/common/owner-container.h +++ b/dali/devel-api/common/owner-container.h @@ -2,7 +2,7 @@ #define __DALI_OWNER_CONTAINER_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -83,6 +83,26 @@ public: } /** + * Erase an object from OwnerContainer + * @param object to remove + */ + inline void EraseObject( T object ) + { + DALI_ASSERT_DEBUG( object && "NULL object not allowed" ); + + Iterator iter = Vector< T >::Begin(); + const ConstIterator endIter = Vector< T >::End(); + for ( ; iter != endIter; ++iter ) + { + if ( *iter == object ) + { + Erase( iter ); + return; + } + } + } + + /** * Release the ownership of an object, without deleting it. * @param[in] position A dereferencable iterator to an element in mContainer. * @post iterators are invalidated by this method. diff --git a/dali/devel-api/images/distance-field.cpp b/dali/devel-api/images/distance-field.cpp index bb4224a..6e4346d 100644 --- a/dali/devel-api/images/distance-field.cpp +++ b/dali/devel-api/images/distance-field.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -196,8 +196,8 @@ void GenerateDistanceFieldMap(const unsigned char* const imagePixels, const Size { for ( int x = 0; x < paddedWidth; ++x) { - if( y < (int)fieldBorder || y >= (paddedHeight - (int)fieldBorder) || - x < (int)fieldBorder || x >= (paddedWidth - (int)fieldBorder) ) + if( y < static_cast< int >( fieldBorder ) || y >= ( paddedHeight - static_cast< int >( fieldBorder ) ) || + x < static_cast< int >( fieldBorder ) || x >= ( paddedWidth - static_cast< int >( fieldBorder ) ) ) { outside[ y * paddedWidth + x ] = MAX_DISTANCE; inside[ y * paddedWidth + x ] = 0.0f; diff --git a/dali/devel-api/scripting/scripting.h b/dali/devel-api/scripting/scripting.h index 3216df4..6149155 100644 --- a/dali/devel-api/scripting/scripting.h +++ b/dali/devel-api/scripting/scripting.h @@ -245,7 +245,7 @@ const char* GetEnumerationName( T value, const StringEnum* table, unsigned int t template< typename T > const char * GetLinearEnumerationName( T value, const StringEnum* table, unsigned int tableCount ) { - if ( table && ( value > 0 || value <= (int)tableCount ) ) + if ( table && ( value > 0 || value <= static_cast( tableCount ) ) ) { return table[value].string; } diff --git a/dali/integration-api/bitmap.h b/dali/integration-api/bitmap.h index 01b3b4c..1e1b9bc 100644 --- a/dali/integration-api/bitmap.h +++ b/dali/integration-api/bitmap.h @@ -267,6 +267,13 @@ public: * This property can then be tested for with IsFullyOpaque(). */ virtual void TestForTransparency() = 0; + + protected: + + /** + * Virtual destructor, no deletion through this interface + */ + virtual ~PackedPixelsProfile() {} }; /** @@ -304,6 +311,12 @@ public: const unsigned width, const unsigned height, const size_t numBytes ) = 0; + protected: + + /** + * Virtual destructor, no deletion through this interface + */ + virtual ~CompressedProfile() {} }; virtual const CompressedProfile* GetCompressedProfile() const { return 0; } @@ -331,6 +344,8 @@ public: */ void DeletePixelBuffer(); +protected: + /** * A reference counted object may only be deleted by calling Unreference() */ diff --git a/dali/integration-api/context-notifier.h b/dali/integration-api/context-notifier.h index 348f292..86cbc6d 100644 --- a/dali/integration-api/context-notifier.h +++ b/dali/integration-api/context-notifier.h @@ -46,6 +46,14 @@ public: * Multi-threading note: this method should be called from the main thread */ virtual void NotifyContextRegained() = 0; + +protected: + + /** + * Virtual destructor, no deletion through this interface + */ + virtual ~ContextNotifierInterface() {} + }; } // namespace Integration diff --git a/dali/integration-api/file.list b/dali/integration-api/file.list index 614ea22..afcc494 100644 --- a/dali/integration-api/file.list +++ b/dali/integration-api/file.list @@ -31,7 +31,6 @@ platform_abstraction_header_files = \ $(platform_abstraction_src_dir)/bitmap.h \ $(platform_abstraction_src_dir)/resource-policies.h \ $(platform_abstraction_src_dir)/resource-types.h \ - $(platform_abstraction_src_dir)/resource-declarations.h \ $(platform_abstraction_src_dir)/gl-abstraction.h \ $(platform_abstraction_src_dir)/gl-defines.h \ $(platform_abstraction_src_dir)/gl-sync-abstraction.h \ diff --git a/dali/integration-api/gesture-manager.h b/dali/integration-api/gesture-manager.h index ba32f03..c86db4a 100644 --- a/dali/integration-api/gesture-manager.h +++ b/dali/integration-api/gesture-manager.h @@ -57,6 +57,13 @@ public: */ virtual void Update(const GestureRequest& request) = 0; +protected: + + /** + * Virtual destructor, no deletion through this interface + */ + virtual ~GestureManager() {} + }; // class GestureManager } // namespace Integration diff --git a/dali/integration-api/gl-defines.h b/dali/integration-api/gl-defines.h index eebb484..8a2f740 100644 --- a/dali/integration-api/gl-defines.h +++ b/dali/integration-api/gl-defines.h @@ -859,5 +859,9 @@ #define GL_TEXTURE_EXTERNAL_OES 0x8D65 #endif +/* GL_SAMPLER_EXTERNAL_OES */ +#ifndef GL_SAMPLER_EXTERNAL_OES +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#endif #endif // __DALI_INTERNAL_GL_DEFINES_H__ diff --git a/dali/integration-api/platform-abstraction.h b/dali/integration-api/platform-abstraction.h index ad79582..db2586b 100644 --- a/dali/integration-api/platform-abstraction.h +++ b/dali/integration-api/platform-abstraction.h @@ -30,7 +30,7 @@ namespace Dali namespace Integration { - +typedef unsigned int ResourceId; typedef IntrusivePtr ResourcePointer; /** diff --git a/dali/integration-api/resource-declarations.h b/dali/integration-api/resource-declarations.h deleted file mode 100644 index a17af2e..0000000 --- a/dali/integration-api/resource-declarations.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef __DALI_INTEGRATION_RESOURCE_DECLARATIONS_H__ -#define __DALI_INTEGRATION_RESOURCE_DECLARATIONS_H__ - -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -namespace Dali -{ - -namespace Integration -{ - -/** - * @brief Used to identify a resource loading operation. - * - * These unique ResourceId values can be used to identify a resource loading - * transaction in core-adaptor communication. - * A resource transaction is asynchronous and many can be in-flight - * concurrently. - * A ResourceId allows the core to track a resource transaction over its - * lifetime and match an asynchronous completion notification to the - * corresponding load request or to cancel the operation early. - * - * A resource transaction begins with a call to PlatformAbstraction::LoadResource() - * Later asynchronous status notifications obtained by polling - * PlatformAbstraction::GetResources() can be mapped to corresponding - * LoadResource() invocations using the ResourceId value. - * It is the core's responsibility to ensure that each invocation of - * PlatformAbstraction::LoadResource() passes in a Request object with a unique - * integer ResourceId. - * - * @sa Dali::Integration::PlatformAbstraction::LoadResource - * Dali::Integration::PlatformAbstraction::GetResources - * Dali::Integration::ResourceCache - */ -typedef unsigned int ResourceId; -const ResourceId InvalidResourceId = (ResourceId)-1; - -/** - * Used to inform the current loading status - */ -enum LoadStatus -{ - RESOURCE_LOADING, ///< There are missing resources, being loaded - RESOURCE_PARTIALLY_LOADED, ///< Enough resource has been loaded to start low quality rendering - RESOURCE_COMPLETELY_LOADED, ///< The resource has been completely loaded -}; - -} // namespace Integration - -} // namespace Dali - -#endif // __DALI_INTEGRATION_RESOURCE_DECLARATIONS_H__ diff --git a/dali/integration-api/resource-types.h b/dali/integration-api/resource-types.h index db03510..d793a0c 100644 --- a/dali/integration-api/resource-types.h +++ b/dali/integration-api/resource-types.h @@ -2,7 +2,7 @@ #define __DALI_INTEGRATION_RESOURCE_TYPES_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -28,7 +28,6 @@ #include #include #include -#include namespace Dali { diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 8d944b6..8df598e 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -133,6 +133,7 @@ struct Actor::RelayoutData for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i ) { resizePolicies[ i ] = ResizePolicy::DEFAULT; + useAssignedSize[ i ] = false; negotiatedDimensions[ i ] = 0.0f; dimensionNegotiated[ i ] = false; dimensionDirty[ i ] = false; @@ -144,6 +145,7 @@ struct Actor::RelayoutData } ResizePolicy::Type resizePolicies[ Dimension::DIMENSION_COUNT ]; ///< Resize policies + bool useAssignedSize[ Dimension::DIMENSION_COUNT ]; ///< The flag to specify whether the size should be assigned to the actor Dimension::Type dimensionDependencies[ Dimension::DIMENSION_COUNT ]; ///< A list of dimension dependencies @@ -1054,19 +1056,7 @@ Matrix Actor::GetCurrentWorldMatrix() const void Actor::SetVisible( bool visible ) { - if( mVisible != visible ) - { - if( NULL != mNode ) - { - // mNode is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyMessage::Send( GetEventThreadServices(), mNode, &mNode->mVisible, &AnimatableProperty::Bake, visible ); - } - - mVisible = visible; - - // Emit the signal on this actor and all its children - EmitVisibilityChangedSignalRecursively( this, visible, DevelActor::VisibilityChange::SELF ); - } + SetVisibleInternal( visible, SendMessage::TRUE ); } bool Actor::IsVisible() const @@ -1288,53 +1278,6 @@ void Actor::SetSizeInternal( const Vector3& size ) } } -void Actor::NotifySizeAnimation( Animation& animation, const Vector3& targetSize ) -{ - mTargetSize = targetSize; - - // Notify deriving classes - OnSizeAnimation( animation, mTargetSize ); -} - -void Actor::NotifySizeAnimation( Animation& animation, float targetSize, Property::Index property ) -{ - if ( Dali::Actor::Property::SIZE_WIDTH == property ) - { - mTargetSize.width = targetSize; - } - else if ( Dali::Actor::Property::SIZE_HEIGHT == property ) - { - mTargetSize.height = targetSize; - } - else if ( Dali::Actor::Property::SIZE_DEPTH == property ) - { - mTargetSize.depth = targetSize; - } - // Notify deriving classes - OnSizeAnimation( animation, mTargetSize ); -} - -void Actor::NotifyPositionAnimation( Animation& animation, const Vector3& targetPosition ) -{ - mTargetPosition = targetPosition; -} - -void Actor::NotifyPositionAnimation( Animation& animation, float targetPosition, Property::Index property ) -{ - if ( Dali::Actor::Property::POSITION_X == property ) - { - mTargetPosition.x = targetPosition; - } - else if ( Dali::Actor::Property::POSITION_Y == property ) - { - mTargetPosition.y = targetPosition; - } - else if ( Dali::Actor::Property::POSITION_Z == property ) - { - mTargetPosition.z = targetPosition; - } -} - void Actor::SetWidth( float width ) { if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout ) @@ -1433,7 +1376,15 @@ void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimensio { if( dimension & ( 1 << i ) ) { - mRelayoutData->resizePolicies[ i ] = policy; + if ( policy == ResizePolicy::USE_ASSIGNED_SIZE ) + { + mRelayoutData->useAssignedSize[ i ] = true; + } + else + { + mRelayoutData->resizePolicies[ i ] = policy; + mRelayoutData->useAssignedSize[ i ] = false; + } } } @@ -1496,7 +1447,14 @@ ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const { if( ( dimension & ( 1 << i ) ) ) { - return mRelayoutData->resizePolicies[ i ]; + if( mRelayoutData->useAssignedSize[ i ] ) + { + return ResizePolicy::USE_ASSIGNED_SIZE; + } + else + { + return mRelayoutData->resizePolicies[ i ]; + } } } } @@ -3284,6 +3242,149 @@ Property::Value Actor::GetDefaultPropertyCurrentValue( Property::Index index ) c return value; } +void Actor::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value ) +{ + switch( index ) + { + case Dali::Actor::Property::SIZE: + { + if( value.Get( mTargetSize ) ) + { + // Notify deriving classes + OnSizeAnimation( animation, mTargetSize ); + } + break; + } + + case Dali::Actor::Property::SIZE_WIDTH: + { + if( value.Get( mTargetSize.width ) ) + { + // Notify deriving classes + OnSizeAnimation( animation, mTargetSize ); + } + break; + } + + case Dali::Actor::Property::SIZE_HEIGHT: + { + if( value.Get( mTargetSize.height ) ) + { + // Notify deriving classes + OnSizeAnimation( animation, mTargetSize ); + } + break; + } + + case Dali::Actor::Property::SIZE_DEPTH: + { + if( value.Get( mTargetSize.depth ) ) + { + // Notify deriving classes + OnSizeAnimation( animation, mTargetSize ); + } + break; + } + + case Dali::Actor::Property::POSITION: + { + value.Get( mTargetPosition ); + break; + } + + case Dali::Actor::Property::POSITION_X: + { + value.Get( mTargetPosition.x ); + break; + } + + case Dali::Actor::Property::POSITION_Y: + { + value.Get( mTargetPosition.y ); + break; + } + + case Dali::Actor::Property::POSITION_Z: + { + value.Get( mTargetPosition.z ); + break; + } + + case Dali::Actor::Property::ORIENTATION: + { + value.Get( mTargetOrientation ); + break; + } + + case Dali::Actor::Property::SCALE: + { + value.Get( mTargetScale ); + break; + } + + case Dali::Actor::Property::SCALE_X: + { + value.Get( mTargetScale.x ); + break; + } + + case Dali::Actor::Property::SCALE_Y: + { + value.Get( mTargetScale.y ); + break; + } + + case Dali::Actor::Property::SCALE_Z: + { + value.Get( mTargetScale.z ); + break; + } + + case Dali::Actor::Property::VISIBLE: + { + SetVisibleInternal( value.Get< bool >(), SendMessage::FALSE ); + break; + } + + case Dali::Actor::Property::COLOR: + { + value.Get( mTargetColor ); + break; + } + + case Dali::Actor::Property::COLOR_RED: + { + value.Get( mTargetColor.r ); + break; + } + + case Dali::Actor::Property::COLOR_GREEN: + { + value.Get( mTargetColor.g ); + break; + } + + case Dali::Actor::Property::COLOR_BLUE: + { + value.Get( mTargetColor.b ); + break; + } + + case Dali::Actor::Property::COLOR_ALPHA: + case Dali::DevelActor::Property::OPACITY: + { + value.Get( mTargetColor.a ); + break; + } + + default: + { + // Not an animatable property. Do nothing. + break; + } + } +} + const SceneGraph::PropertyOwner* Actor::GetPropertyOwner() const { return mNode; @@ -4206,6 +4307,12 @@ bool Actor::GetCurrentPropertyValue( Property::Index index, Property::Value& val break; } + case Dali::Actor::Property::VISIBLE: + { + value = IsVisible(); + break; + } + default: { // Must be an event-side only property @@ -4772,13 +4879,13 @@ void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& cont // container to be relayed out. DALI_LOG_TIMER_START( NegSizeTimer1 ); - if(GetResizePolicy(Dimension::WIDTH) == ResizePolicy::USE_ASSIGNED_SIZE) + if( GetUseAssignedSize(Dimension::WIDTH ) ) { - SetLayoutNegotiated(false, Dimension::WIDTH); + SetLayoutNegotiated( false, Dimension::WIDTH ); } - if(GetResizePolicy(Dimension::HEIGHT) == ResizePolicy::USE_ASSIGNED_SIZE) + if( GetUseAssignedSize( Dimension::HEIGHT ) ) { - SetLayoutNegotiated(false, Dimension::HEIGHT); + SetLayoutNegotiated( false, Dimension::HEIGHT ); } // Do the negotiation @@ -4796,12 +4903,13 @@ void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& cont // Forces children that have already been laid out to be relayed out // if they have assigned size during relayout. - if(child->GetResizePolicy(Dimension::WIDTH) == ResizePolicy::USE_ASSIGNED_SIZE) + if( child->GetUseAssignedSize(Dimension::WIDTH) ) { child->SetLayoutNegotiated(false, Dimension::WIDTH); child->SetLayoutDirty(true, Dimension::WIDTH); } - if(child->GetResizePolicy(Dimension::HEIGHT) == ResizePolicy::USE_ASSIGNED_SIZE) + + if( child->GetUseAssignedSize(Dimension::HEIGHT) ) { child->SetLayoutNegotiated(false, Dimension::HEIGHT); child->SetLayoutDirty(true, Dimension::HEIGHT); @@ -4816,6 +4924,37 @@ void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& cont DALI_LOG_TIMER_END( NegSizeTimer1, gLogRelayoutFilter, Debug::Concise, "NegotiateSize() took: "); } +void Actor::SetUseAssignedSize( bool use, Dimension::Type dimension ) +{ + if( mRelayoutData ) + { + for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + { + if( dimension & ( 1 << i ) ) + { + mRelayoutData->useAssignedSize[ i ] = use; + } + } + } +} + +bool Actor::GetUseAssignedSize( Dimension::Type dimension ) const +{ + if ( mRelayoutData ) + { + // If more than one dimension is requested, just return the first one found + for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + { + if( dimension & ( 1 << i ) ) + { + return mRelayoutData->useAssignedSize[ i ]; + } + } + } + + return false; +} + void Actor::RelayoutRequest( Dimension::Type dimension ) { Internal::RelayoutController* relayoutController = Internal::RelayoutController::Get(); @@ -4930,6 +5069,23 @@ Object* Actor::GetParentObject() const return mParent; } +void Actor::SetVisibleInternal( bool visible, SendMessage::Type sendMessage ) +{ + if( mVisible != visible ) + { + if( sendMessage == SendMessage::TRUE && NULL != mNode ) + { + // mNode is being used in a separate thread; queue a message to set the value & base value + SceneGraph::NodePropertyMessage::Send( GetEventThreadServices(), mNode, &mNode->mVisible, &AnimatableProperty::Bake, visible ); + } + + mVisible = visible; + + // Emit the signal on this actor and all its children + EmitVisibilityChangedSignalRecursively( this, visible, DevelActor::VisibilityChange::SELF ); + } +} + void Actor::SetSiblingOrder( unsigned int order ) { mSiblingOrder = std::min( order, static_cast( DevelLayer::SIBLING_ORDER_MULTIPLIER ) ); diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index 32ddb5d..59e23d0 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -619,7 +619,7 @@ public: /** * Sets the visibility flag of an actor. - * @param [in] visible The new visibility flag. + * @param[in] visible The new visibility flag. */ void SetVisible( bool visible ); @@ -881,6 +881,24 @@ public: void NegotiateSize( const Vector2& size, RelayoutContainer& container ); /** + * @brief Set whether size negotiation should use the assigned size of the actor + * during relayout for the given dimension(s) + * + * @param[in] use Whether the assigned size of the actor should be used + * @param[in] dimension The dimension(s) to set. Can be a bitfield of multiple dimensions + */ + void SetUseAssignedSize( bool use, Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); + + /** + * @brief Returns whether size negotiation should use the assigned size of the actor + * during relayout for a single dimension + * + * @param[in] dimension The dimension to get + * @return Return whether the assigned size of the actor should be used. If more than one dimension is requested, just return the first one found + */ + bool GetUseAssignedSize( Dimension::Type dimension ) const; + + /** * @copydoc Dali::Actor::SetResizePolicy() */ void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); @@ -1468,23 +1486,6 @@ public: // For Animation /** - * This should only be called by Animation, when the actors SIZE property is animated. - * - * @param[in] animation The animation that resized the actor - * @param[in] targetSize The new target size of the actor - */ - void NotifySizeAnimation( Animation& animation, const Vector3& targetSize ); - - /** - * This should only be called by Animation, when the actors SIZE_WIDTH or SIZE_HEIGHT or SIZE_DEPTH property is animated. - * - * @param[in] animation The animation that resized the actor - * @param[in] targetSize The new target size of the actor - * @param[in] property The index of the property being animated - */ - void NotifySizeAnimation( Animation& animation, float targetSize, Property::Index property ); - - /** * For use in derived classes. * This should only be called by Animation, when the actor is resized using Animation::Resize(). */ @@ -1492,23 +1493,6 @@ public: { } - /** - * This should only be called by Animation, when the actors POSITION property is animated. - * - * @param[in] animation The animation that repositioned the actor - * @param[in] targetPosition The new target position of the actor - */ - void NotifyPositionAnimation( Animation& animation, const Vector3& targetPosition ); - - /** - * This should only be called by Animation, when the actors POSITION_X or POSITION_Y or POSITION_Z property is animated. - * - * @param[in] animation The animation that repositioned the actor - * @param[in] targetPosition The new target position of the actor - * @param[in] property The index of the property being animated - */ - void NotifyPositionAnimation( Animation& animation, float targetPosition, Property::Index property ); - protected: enum DerivedType @@ -1670,6 +1654,11 @@ public: virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const; /** + * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation() + */ + virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value ); + + /** * @copydoc Dali::Internal::Object::GetPropertyOwner() */ virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const; @@ -1726,6 +1715,15 @@ public: private: + struct SendMessage + { + enum Type + { + FALSE = 0, + TRUE = 1, + }; + }; + // Undefined Actor(); @@ -1904,7 +1902,6 @@ private: */ bool ShiftSiblingsLevels( ActorContainer& siblings, int targetLevelToShiftFrom ); - /** * @brief Get the current position of the actor in screen coordinates. * @@ -1912,6 +1909,13 @@ private: */ const Vector2 GetCurrentScreenPosition() const; + /** + * Sets the visibility flag of an actor. + * @param[in] visible The new visibility flag. + * @param[in] sendMessage Whether to send a message to the update thread or not. + */ + void SetVisibleInternal( bool visible, SendMessage::Type sendMessage ); + protected: Actor* mParent; ///< Each actor (except the root) can have one parent diff --git a/dali/internal/event/animation/animation-impl.cpp b/dali/internal/event/animation/animation-impl.cpp index c09c4b1..2191e2a 100644 --- a/dali/internal/event/animation/animation-impl.cpp +++ b/dali/internal/event/animation/animation-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -22,14 +22,12 @@ // EXTERNAL INCLUDES // INTERNAL INCLUDES -#include #include #include #include #include #include #include -#include #include #include #include @@ -114,17 +112,18 @@ AnimationPtr Animation::New(float durationSeconds) } Animation::Animation( EventThreadServices& eventThreadServices, AnimationPlaylist& playlist, float durationSeconds, EndAction endAction, EndAction disconnectAction, AlphaFunction defaultAlpha ) -: mEventThreadServices( eventThreadServices ), +: mAnimation( NULL ), + mEventThreadServices( eventThreadServices ), mPlaylist( playlist ), - mAnimation( NULL ), - mNotificationCount( 0 ), - mFinishedCallback( NULL ), - mFinishedCallbackObject( NULL ), + mFinishedSignal(), + mConnectors(), + mConnectorTargetValues(), + mPlayRange( Vector2(0.0f,1.0f)), mDurationSeconds( durationSeconds ), mSpeedFactor(1.0f), + mNotificationCount( 0 ), mLoopCount(1), mCurrentLoop(0), - mPlayRange( Vector2(0.0f,1.0f)), mEndAction( endAction ), mDisconnectAction( disconnectAction ), mDefaultAlpha( defaultAlpha ), @@ -267,73 +266,22 @@ void Animation::Play() mState = Dali::Animation::PLAYING; - unsigned int connectorTargetValuesIndex( 0 ); - unsigned int numberOfConnectorTargetValues = mConnectorActorTargetValues.size(); - - /* - * Loop through all Animator connectors, if connector index matches the current index stored in mConnectorActorTargetValues container then - * should apply target values for this index to the Actor. - * Confirm object is an actor and it is a POSITION or SIZE Property Index before sending Notify message to Actor. - */ - for ( unsigned int connectorIndex = 0; connectorIndex < mConnectors.Count(); connectorIndex ++) + if( mEndAction != EndAction::Discard ) // If the animation is discarded, then we do not want to change the target values { - // Use index to check if the current connector is next in the mConnectorActorTargetValues container, meaning targetValues have been pushed in AnimateXXFunction - if ( connectorTargetValuesIndex < numberOfConnectorTargetValues ) + // Sort according to end time with earlier end times coming first, if the end time is the same, then the connectors are not moved + std::stable_sort( mConnectorTargetValues.begin(), mConnectorTargetValues.end(), CompareConnectorEndTimes ); + + // Loop through all connector target values sorted by increasing end time + ConnectorTargetValuesContainer::const_iterator iter = mConnectorTargetValues.begin(); + const ConnectorTargetValuesContainer::const_iterator endIter = mConnectorTargetValues.end(); + for( ; iter != endIter; ++iter ) { - ConnectorTargetValues& connectorPair = mConnectorActorTargetValues[ connectorTargetValuesIndex ]; + AnimatorConnectorBase* connector = mConnectors[ iter->connectorIndex ]; - if ( connectorPair.connectorIndex == connectorIndex ) + Object* object = connector->GetObject(); + if( object ) { - // Current connector index matches next in the stored connectors with target values so apply target value. - connectorTargetValuesIndex++; // Found a match for connector so increment index to next one - - AnimatorConnectorBase* connector = mConnectors[ connectorIndex ]; - - Actor* maybeActor = static_cast( connector->GetObject() ); // Only Actors would be in mConnectorActorTargetValues container - - if ( maybeActor ) - { - // Get Stored Target Value and corresponding connector index - const Property::Type valueType = connectorPair.targetValue.GetType(); - Property::Index propertyIndex = connector->GetPropertyIndex(); - - if ( valueType == Property::VECTOR3 ) - { - Vector3 targetVector3 = connectorPair.targetValue.Get(); - - if ( propertyIndex == Dali::Actor::Property::POSITION ) - { - maybeActor->NotifyPositionAnimation( *this, targetVector3 ); - } - else if ( propertyIndex == Dali::Actor::Property::SIZE ) - { - maybeActor->NotifySizeAnimation( *this, targetVector3 ); - } - } - else if ( valueType == Property::FLOAT ) - { - float targetFloat = connectorPair.targetValue.Get(); - - if ( ( Dali::Actor::Property::POSITION_X == propertyIndex ) || - ( Dali::Actor::Property::POSITION_Y == propertyIndex ) || - ( Dali::Actor::Property::POSITION_Z == propertyIndex ) ) - { - maybeActor->NotifyPositionAnimation( *this, targetFloat, propertyIndex ); - } - else if ( ( Dali::Actor::Property::SIZE_WIDTH == propertyIndex ) || - ( Dali::Actor::Property::SIZE_HEIGHT == propertyIndex ) || - ( Dali::Actor::Property::SIZE_DEPTH == propertyIndex ) ) - - { - maybeActor->NotifySizeAnimation( *this, targetFloat, propertyIndex ); - } - } - else - { - // Currently only FLOAT and VECTOR3 is supported for Target values in AnimateXXFunctions - DALI_LOG_WARNING("Animation::Play Unsupported Value Type provided as TargetValue\n"); - } - } + object->NotifyPropertyAnimation( *this, connector->GetPropertyIndex(), iter->targetValue ); } } } @@ -384,6 +332,9 @@ void Animation::Clear() // Remove all the connectors mConnectors.Clear(); + // Reset the connector target values + mConnectorTargetValues.clear(); + // Replace the old scene-object with a new one DestroySceneObject(); CreateSceneObject(); @@ -546,6 +497,13 @@ void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIn ExtendDuration( period ); + // Store data to later notify the object that its property is being animated + ConnectorTargetValues connectorPair; + connectorPair.targetValue = destinationValue; + connectorPair.connectorIndex = mConnectors.Count(); + connectorPair.timePeriod = period; + mConnectorTargetValues.push_back( connectorPair ); + switch ( destinationType ) { case Property::BOOLEAN: @@ -572,26 +530,6 @@ void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIn case Property::FLOAT: { - if ( ( Dali::Actor::Property::SIZE_WIDTH == targetPropertyIndex ) || - ( Dali::Actor::Property::SIZE_HEIGHT == targetPropertyIndex ) || - ( Dali::Actor::Property::SIZE_DEPTH == targetPropertyIndex ) || - ( Dali::Actor::Property::POSITION_X == targetPropertyIndex ) || - ( Dali::Actor::Property::POSITION_Y == targetPropertyIndex ) || - ( Dali::Actor::Property::POSITION_Z == targetPropertyIndex ) ) - { - - Actor* maybeActor = dynamic_cast( &targetObject ); - if ( maybeActor ) - { - // Store data to later notify the actor that its size or position is being animated - ConnectorTargetValues connectorPair; - connectorPair.targetValue = destinationValue; - connectorPair.connectorIndex = mConnectors.Count(); - - mConnectorActorTargetValues.push_back( connectorPair ); - } - } - AddAnimatorConnector( AnimatorConnector::New( targetObject, targetPropertyIndex, componentIndex, @@ -614,21 +552,6 @@ void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIn case Property::VECTOR3: { - if ( Dali::Actor::Property::SIZE == targetPropertyIndex || Dali::Actor::Property::POSITION == targetPropertyIndex ) - { - // Test whether this is actually an Actor - Actor* maybeActor = dynamic_cast( &targetObject ); - if ( maybeActor ) - { - // Store data to later notify the actor that its size or position is being animated - ConnectorTargetValues connectorPair; - connectorPair.targetValue = destinationValue; - connectorPair.connectorIndex = mConnectors.Count(); - - mConnectorActorTargetValues.push_back( connectorPair ); - } - } - AddAnimatorConnector( AnimatorConnector::New( targetObject, targetPropertyIndex, componentIndex, @@ -848,12 +771,6 @@ void Animation::EmitSignalFinish() Dali::Animation handle( this ); mFinishedSignal.Emit( handle ); } - - // This callback is used internally, to avoid the overhead of using a signal. - if ( mFinishedCallback ) - { - mFinishedCallback( mFinishedCallbackObject ); - } } bool Animation::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) @@ -874,12 +791,6 @@ bool Animation::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* return connected; } -void Animation::SetFinishedCallback( FinishedCallback callback, Object* object ) -{ - mFinishedCallback = callback; - mFinishedCallbackObject = object; -} - void Animation::AddAnimatorConnector( AnimatorConnectorBase* connector ) { DALI_ASSERT_DEBUG( NULL != connector ); @@ -1055,6 +966,10 @@ Vector2 Animation::GetPlayRange() const return mPlayRange; } +bool Animation::CompareConnectorEndTimes( const Animation::ConnectorTargetValues& lhs, const Animation::ConnectorTargetValues& rhs ) +{ + return ( ( lhs.timePeriod.delaySeconds + lhs.timePeriod.durationSeconds ) < ( rhs.timePeriod.delaySeconds + rhs.timePeriod.durationSeconds ) ); +} } // namespace Internal diff --git a/dali/internal/event/animation/animation-impl.h b/dali/internal/event/animation/animation-impl.h index 7239ed4..92dff74 100644 --- a/dali/internal/event/animation/animation-impl.h +++ b/dali/internal/event/animation/animation-impl.h @@ -62,8 +62,6 @@ public: typedef Dali::Animation::EndAction EndAction; typedef Dali::Animation::Interpolation Interpolation; - typedef void (*FinishedCallback)(Object* object); - /** * Create a new Animation object. * @param[in] durationSeconds The duration of the animation. @@ -210,13 +208,6 @@ public: static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes); /** - * This callback is intended for internal use only, to avoid the overhead of using a signal. - * @param[in] callback The callback function to connect. - * @param[in] object The internal object requesting the callback, or NULL. - */ - void SetFinishedCallback( FinishedCallback callback, Object* object ); - - /** * @copydoc Dali::Animation::AnimateBy(Property target, Property::Value relativeValue) */ void AnimateBy(Property& target, Property::Value& relativeValue); @@ -451,37 +442,53 @@ private: struct ConnectorTargetValues { - unsigned int connectorIndex; + ConnectorTargetValues() + : targetValue(), + timePeriod( 0.0f ), + connectorIndex( 0 ) + { + } + Property::Value targetValue; + TimePeriod timePeriod; + unsigned int connectorIndex; }; - EventThreadServices& mEventThreadServices; - AnimationPlaylist& mPlaylist; +private: + + /** + * Compares the end times of the animators returning true if lhs end time is less than rhs end time. + * @param[in] lhs The first comparator + * @param[in] rhs The second comparator + * @return True if end time of lhs is less, false otherwise. + */ + static bool CompareConnectorEndTimes( const ConnectorTargetValues& lhs, const ConnectorTargetValues& rhs ); + +private: const SceneGraph::Animation* mAnimation; - int mNotificationCount; ///< Keep track of how many Finished signals have been emitted. + EventThreadServices& mEventThreadServices; + AnimationPlaylist& mPlaylist; Dali::Animation::AnimationSignalType mFinishedSignal; - FinishedCallback mFinishedCallback; - Object* mFinishedCallbackObject; - AnimatorConnectorContainer mConnectors; ///< Owned by the Animation - std::vector< ConnectorTargetValues > mConnectorActorTargetValues; //< Store Actor target values and matchinf connector index that need to set value on Animation::Play + typedef std::vector< ConnectorTargetValues > ConnectorTargetValuesContainer; + ConnectorTargetValuesContainer mConnectorTargetValues; //< Used to store animating property target value information + + Vector2 mPlayRange; - // Cached for public getters float mDurationSeconds; float mSpeedFactor; + int mNotificationCount; ///< Keep track of how many Finished signals have been emitted. int mLoopCount; int mCurrentLoop; - Vector2 mPlayRange; EndAction mEndAction; EndAction mDisconnectAction; AlphaFunction mDefaultAlpha; Dali::Animation::State mState; - }; } // namespace Internal diff --git a/dali/internal/event/animation/path-impl.cpp b/dali/internal/event/animation/path-impl.cpp index 6242e66..865c4fa 100644 --- a/dali/internal/event/animation/path-impl.cpp +++ b/dali/internal/event/animation/path-impl.cpp @@ -348,7 +348,7 @@ void Path::FindSegmentAndProgress( float t, unsigned int& segment, float& tLocal { segment = t * numSegs; float segLength = 1.0f / numSegs; - float segStart = (float)segment * segLength; + float segStart = static_cast( segment ) * segLength; tLocal = (t - segStart) * numSegs; } } diff --git a/dali/internal/event/common/object-impl.cpp b/dali/internal/event/common/object-impl.cpp index d43ccf7..da2f58d 100644 --- a/dali/internal/event/common/object-impl.cpp +++ b/dali/internal/event/common/object-impl.cpp @@ -924,6 +924,32 @@ void Object::RemovePropertyNotifications() } } +void Object::NotifyPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value ) +{ + if ( index < DEFAULT_PROPERTY_MAX_COUNT ) + { + OnNotifyDefaultPropertyAnimation( animation, index, value ); + } + else if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) ) + { + AnimatablePropertyMetadata* animatableProperty = FindAnimatableProperty( index ); + if( animatableProperty ) + { + // update the cached property value + animatableProperty->SetPropertyValue( value ); + } + } + else + { + CustomPropertyMetadata* custom = FindCustomProperty( index ); + if( custom && custom->IsAnimatable() ) + { + // update the cached property value + custom->SetPropertyValue( value ); + } + } +} + void Object::EnablePropertyNotifications() { if( mPropertyNotifications ) @@ -1422,7 +1448,7 @@ CustomPropertyMetadata* Object::FindCustomProperty( Property::Index index ) cons int arrayIndex = index - PROPERTY_CUSTOM_START_INDEX; if( arrayIndex >= 0 ) { - if( arrayIndex < (int)mCustomProperties.Count() ) // we can only access the first 2 billion custom properties + if( arrayIndex < static_cast( mCustomProperties.Count() ) ) // we can only access the first 2 billion custom properties { property = static_cast(mCustomProperties[ arrayIndex ]); } @@ -1433,7 +1459,8 @@ CustomPropertyMetadata* Object::FindCustomProperty( Property::Index index ) cons AnimatablePropertyMetadata* Object::FindAnimatableProperty( Property::Index index ) const { - for ( int arrayIndex = 0; arrayIndex < (int)mAnimatableProperties.Count(); arrayIndex++ ) + const PropertyMetadataLookup::SizeType count = mAnimatableProperties.Count(); + for ( PropertyMetadataLookup::SizeType arrayIndex = 0; arrayIndex < count; ++arrayIndex ) { AnimatablePropertyMetadata* property = static_cast( mAnimatableProperties[ arrayIndex ] ); if( property->index == index ) @@ -1505,7 +1532,8 @@ void Object::ResolveChildProperties() if( parentTypeInfo ) { // Go through each custom property - for ( int arrayIndex = 0; arrayIndex < (int)mCustomProperties.Count(); arrayIndex++ ) + const PropertyMetadataLookup::SizeType count = mCustomProperties.Count(); + for ( PropertyMetadataLookup::SizeType arrayIndex = 0; arrayIndex < count; ++arrayIndex ) { CustomPropertyMetadata* customProperty = static_cast( mCustomProperties[ arrayIndex ] ); diff --git a/dali/internal/event/common/object-impl.h b/dali/internal/event/common/object-impl.h index d378674..035e7ee 100644 --- a/dali/internal/event/common/object-impl.h +++ b/dali/internal/event/common/object-impl.h @@ -41,6 +41,7 @@ class PropertyNotification; namespace Internal { +class Animation; class ConstraintBase; class EventThreadServices; class Handle; @@ -239,6 +240,14 @@ public: */ virtual void RemovePropertyNotifications(); + /** + * Notifies that a property is being animated. + * @param[in] animation The animation animating the property. + * @param[in] index The index of the property. + * @param[in] value The value of the property after the animation. + */ + void NotifyPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value ); + /******************************** Uniform Mappings ********************************/ /** @@ -479,6 +488,15 @@ private: // Default property extensions for derived classes virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const = 0; /** + * Notifies that a default property is being animated so the deriving class should update the cached value. + * @param[in] animation The animation animating the property. + * @param[in] index The index of the property. + * @param[in] value The value of the property after the animation. + */ + virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value ) + { } + + /** * @todo this is virtual so that for now actor can override it, * it needs to be removed and only have GetSceneObject but that requires changing actor and constraint logic * Retrieve the scene-graph object added by this object. diff --git a/dali/internal/event/common/stage-impl.cpp b/dali/internal/event/common/stage-impl.cpp index 905cfba..1cd7cf3 100644 --- a/dali/internal/event/common/stage-impl.cpp +++ b/dali/internal/event/common/stage-impl.cpp @@ -705,7 +705,8 @@ Stage::Stage( AnimationPlaylist& playlist, mViewMode( MONO ), mStereoBase( DEFAULT_STEREO_BASE ), mTopMargin( 0 ), - mSystemOverlay(NULL) + mSystemOverlay(NULL), + mDepthTreeDirty( false ) { } diff --git a/dali/internal/event/events/hit-test-algorithm-impl.cpp b/dali/internal/event/events/hit-test-algorithm-impl.cpp index d90e213..56027a0 100644 --- a/dali/internal/event/events/hit-test-algorithm-impl.cpp +++ b/dali/internal/event/events/hit-test-algorithm-impl.cpp @@ -601,6 +601,10 @@ bool HitTestForEachRenderTask( Stage& stage, } // unnamed namespace +HitTestInterface::~HitTestInterface() +{ +} + bool HitTest( Stage& stage, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func ) { bool wasHit( false ); diff --git a/dali/internal/event/events/hit-test-algorithm-impl.h b/dali/internal/event/events/hit-test-algorithm-impl.h index c0b68e3..bfe9cb0 100644 --- a/dali/internal/event/events/hit-test-algorithm-impl.h +++ b/dali/internal/event/events/hit-test-algorithm-impl.h @@ -81,6 +81,14 @@ struct HitTestInterface * @return true if the layer should consume the hit, false otherwise. */ virtual bool DoesLayerConsumeHit( Layer* layer ) = 0; + +protected: + + /** + * Virtual destructor, no deletion through this interface + */ + virtual ~HitTestInterface(); + }; /** diff --git a/dali/internal/event/events/hover-event-processor.cpp b/dali/internal/event/events/hover-event-processor.cpp index 964ad87..a19da0f 100644 --- a/dali/internal/event/events/hover-event-processor.cpp +++ b/dali/internal/event/events/hover-event-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -245,7 +245,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even DALI_LOG_INFO( gLogFilter, Debug::General, " State(%s), Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", TOUCH_POINT_STATE[iter->GetState()], iter->GetScreenPosition().x, iter->GetScreenPosition().y, - ( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ), + ( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ), ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ), hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y ); @@ -269,8 +269,8 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even Dali::Actor primaryHitActor = primaryPoint.hitActor; TouchPoint::State primaryPointState = primaryPoint.state; - DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryPoint.hitActor ? (void*)&primaryPoint.hitActor.GetBaseObject() : NULL, primaryPoint.hitActor ? primaryPoint.hitActor.GetName().c_str() : "" ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryPoint.hitActor ? reinterpret_cast< void* >( &primaryPoint.hitActor.GetBaseObject() ) : NULL, primaryPoint.hitActor ? primaryPoint.hitActor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); if ( ( primaryPointState == TouchPoint::Started ) && ( hoverEvent.GetPointCount() == 1 ) && @@ -299,7 +299,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even { if ( lastPrimaryHitActor->GetLeaveRequired() ) { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit): (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit): (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() ); leaveEventConsumer = EmitHoverSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Leave ); } } @@ -307,7 +307,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even { // At this point mLastPrimaryHitActor was touchable and sensitive in the previous touch event process but is not in the current one. // An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls) - DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit): (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit): (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() ); leaveEventConsumer = EmitHoverSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Interrupted ); } } @@ -325,7 +325,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even { if( lastConsumedActor->GetLeaveRequired() ) { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() ); EmitHoverSignals( lastConsumedActor, lastRenderTaskImpl, hoverEvent, TouchPoint::Leave ); } } @@ -333,7 +333,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even { // At this point mLastConsumedActor was touchable and sensitive in the previous touch event process but is not in the current one. // An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls) - DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume): (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() ); EmitHoverSignals( mLastConsumedActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Interrupted ); } } diff --git a/dali/internal/event/events/touch-event-processor.cpp b/dali/internal/event/events/touch-event-processor.cpp index b9c305c..871d851 100644 --- a/dali/internal/event/events/touch-event-processor.cpp +++ b/dali/internal/event/events/touch-event-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -258,7 +258,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even DALI_LOG_INFO( gLogFilter, Debug::General, " State(%s), Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", TOUCH_POINT_STATE[iter->GetState()], iter->GetScreenPosition().x, iter->GetScreenPosition().y, - ( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ), + ( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ), ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ), hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y ); @@ -282,8 +282,8 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even Dali::Actor primaryHitActor = primaryPoint.GetHitActor(); PointState::Type primaryPointState = primaryPoint.GetState(); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryHitActor ? (void*)&primaryHitActor.GetBaseObject() : NULL, primaryHitActor ? primaryHitActor.GetName().c_str() : "" ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryHitActor ? reinterpret_cast< void* >( &primaryHitActor.GetBaseObject() ) : NULL, primaryHitActor ? primaryHitActor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); if ( ( primaryPointState == PointState::DOWN ) && ( touchEvent.GetPointCount() == 1 ) && @@ -312,7 +312,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even { if ( lastPrimaryHitActor->GetLeaveRequired() ) { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit): (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit): (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() ); leaveEventConsumer = EmitTouchSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, touchEvent, touchData, PointState::LEAVE ); } } @@ -320,7 +320,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even { // At this point mLastPrimaryHitActor was touchable and sensitive in the previous touch event process but is not in the current one. // An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls) - DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit): (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit): (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() ); leaveEventConsumer = EmitTouchSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, touchEvent, touchData, PointState::INTERRUPTED ); } } @@ -338,7 +338,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even { if( lastConsumedActor->GetLeaveRequired() ) { - DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() ); EmitTouchSignals( lastConsumedActor, lastRenderTaskImpl, touchEvent, touchData, PointState::LEAVE ); } } @@ -346,7 +346,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even { // At this point mLastConsumedActor was touchable and sensitive in the previous touch event process but is not in the current one. // An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls) - DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume): (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() ); EmitTouchSignals( mLastConsumedActor.GetActor(), lastRenderTaskImpl, touchEvent, touchData, PointState::INTERRUPTED ); } } diff --git a/dali/internal/event/events/wheel-event-processor.cpp b/dali/internal/event/events/wheel-event-processor.cpp index 6d08325..0dcdb2f 100644 --- a/dali/internal/event/events/wheel-event-processor.cpp +++ b/dali/internal/event/events/wheel-event-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -142,15 +142,15 @@ void WheelEventProcessor::ProcessWheelEvent(const Integration::WheelEvent& event DALI_LOG_INFO( gLogFilter, Debug::General, " Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", event.point.x, event.point.y, - ( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ), + ( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ), ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ), hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y ); // Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached. Dali::Actor consumedActor = EmitWheelSignals( hitTestResults.actor, wheelEvent ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL, hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL, hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); } else { diff --git a/dali/internal/event/images/encoded-buffer-image-impl.cpp b/dali/internal/event/images/encoded-buffer-image-impl.cpp index 6696f4d..6666656 100644 --- a/dali/internal/event/images/encoded-buffer-image-impl.cpp +++ b/dali/internal/event/images/encoded-buffer-image-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -70,8 +70,8 @@ EncodedBufferImagePtr EncodedBufferImage::New( const uint8_t * const encodedImag // Get image size from buffer Dali::Integration::PlatformAbstraction& platformAbstraction = Internal::ThreadLocalStorage::Get().GetPlatformAbstraction(); const ImageDimensions expectedSize = platformAbstraction.GetClosestImageSize( buffer, size, fittingMode, samplingMode, orientationCorrection ); - image->mWidth = (unsigned int) expectedSize.GetWidth(); - image->mHeight = (unsigned int) expectedSize.GetHeight(); + image->mWidth = static_cast( expectedSize.GetWidth() ); + image->mHeight = static_cast( expectedSize.GetHeight() ); // Load the image synchronously Integration::BitmapPtr bitmap = platformAbstraction.DecodeBuffer( resourceType, &(buffer->GetVector()[0]), encodedImageByteCount ); diff --git a/dali/internal/event/render-tasks/render-task-impl.cpp b/dali/internal/event/render-tasks/render-task-impl.cpp index 04dfbb1..a97069b 100644 --- a/dali/internal/event/render-tasks/render-task-impl.cpp +++ b/dali/internal/event/render-tasks/render-task-impl.cpp @@ -689,6 +689,34 @@ Property::Value RenderTask::GetDefaultPropertyCurrentValue( Property::Index inde return value; } +void RenderTask::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value ) +{ + switch ( index ) + { + case Dali::RenderTask::Property::VIEWPORT_POSITION: + { + value.Get( mViewportPosition ); + break; + } + case Dali::RenderTask::Property::VIEWPORT_SIZE: + { + value.Get( mViewportSize ); + break; + } + case Dali::RenderTask::Property::CLEAR_COLOR: + { + value.Get( mClearColor ); + break; + } + case Dali::RenderTask::Property::REQUIRES_SYNC: + default: + { + // Nothing to do as not animatable + break; + } + } +} + const SceneGraph::PropertyOwner* RenderTask::GetSceneObject() const { return mSceneObject; diff --git a/dali/internal/event/render-tasks/render-task-impl.h b/dali/internal/event/render-tasks/render-task-impl.h index b76d0a2..90d5cc3 100644 --- a/dali/internal/event/render-tasks/render-task-impl.h +++ b/dali/internal/event/render-tasks/render-task-impl.h @@ -323,6 +323,11 @@ public: // Implementation of Object virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const; /** + * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation() + */ + virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value ); + + /** * @copydoc Dali::Internal::Object::GetSceneObject() */ virtual const SceneGraph::PropertyOwner* GetSceneObject() const; diff --git a/dali/internal/event/rendering/frame-buffer-impl.cpp b/dali/internal/event/rendering/frame-buffer-impl.cpp index c2cfc80..20d09d3 100644 --- a/dali/internal/event/rendering/frame-buffer-impl.cpp +++ b/dali/internal/event/rendering/frame-buffer-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -59,8 +59,8 @@ void FrameBuffer::Initialize() void FrameBuffer::AttachColorTexture( TexturePtr texture, unsigned int mipmapLevel, unsigned int layer ) { - if( (unsigned int)( texture->GetWidth() / ( 1 << mipmapLevel ) ) == mWidth && - (unsigned int)( texture->GetHeight() / ( 1 << mipmapLevel ) ) == mHeight ) + if( ( texture->GetWidth() / ( 1u << mipmapLevel ) == mWidth ) && + ( texture->GetHeight() / ( 1u << mipmapLevel ) == mHeight ) ) { mColor = texture; AttachColorTextureToFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject, texture->GetRenderObject(), mipmapLevel, layer ); diff --git a/dali/internal/event/rendering/sampler-impl.cpp b/dali/internal/event/rendering/sampler-impl.cpp index ecec053..8f4f25b 100644 --- a/dali/internal/event/rendering/sampler-impl.cpp +++ b/dali/internal/event/rendering/sampler-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -39,7 +39,7 @@ void Sampler::SetFilterMode( Dali::FilterMode::Type minFilter, Dali::FilterMode: { if( NULL != mRenderObject ) { - SetFilterModeMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, (unsigned int)minFilter, (unsigned int)magFilter ); + SetFilterModeMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, static_cast< unsigned int >( minFilter ), static_cast< unsigned int >( magFilter ) ); } } @@ -47,7 +47,7 @@ void Sampler::SetWrapMode( Dali::WrapMode::Type rWrap, Dali::WrapMode::Type sWra { if( NULL != mRenderObject ) { - SetWrapModeMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, (unsigned int)rWrap, (unsigned int)sWrap, (unsigned int)tWrap ); + SetWrapModeMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, static_cast< unsigned int >( rWrap ), static_cast< unsigned int >( sWrap ), static_cast< unsigned int >( tWrap ) ); } } diff --git a/dali/internal/event/size-negotiation/relayout-controller-impl.cpp b/dali/internal/event/size-negotiation/relayout-controller-impl.cpp index eebc981..0b3ec2c 100644 --- a/dali/internal/event/size-negotiation/relayout-controller-impl.cpp +++ b/dali/internal/event/size-negotiation/relayout-controller-impl.cpp @@ -492,6 +492,9 @@ void RelayoutController::Relayout() // has to fill with all the actors it has not done any size negotiation for. actorImpl.NegotiateSize( size, *mRelayoutStack ); + + // Reset the flag so that size negotiation will respect the actor's original resize policy + actorImpl.SetUseAssignedSize( false ); } } diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index aabfbfd..ce2bb78 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -106,15 +106,7 @@ struct RenderManager::Impl void RemoveRenderTracker( Render::RenderTracker* renderTracker ) { - DALI_ASSERT_DEBUG( renderTracker != NULL ); - for(RenderTrackerIter iter = mRenderTrackers.Begin(), end = mRenderTrackers.End(); iter != end; ++iter) - { - if( *iter == renderTracker ) - { - mRenderTrackers.Erase( iter ); - break; - } - } + mRenderTrackers.EraseObject( renderTracker ); } void UpdateTrackers() @@ -252,19 +244,7 @@ void RenderManager::AddRenderer( Render::Renderer* renderer ) void RenderManager::RemoveRenderer( Render::Renderer* renderer ) { - DALI_ASSERT_DEBUG( NULL != renderer ); - - RendererOwnerContainer& renderers = mImpl->rendererContainer; - - // Find the renderer - for ( RendererOwnerIter iter = renderers.Begin(); iter != renderers.End(); ++iter ) - { - if ( *iter == renderer ) - { - renderers.Erase( iter ); // Renderer found; now destroy it - break; - } - } + mImpl->rendererContainer.EraseObject( renderer ); } void RenderManager::AddSampler( Render::Sampler* sampler ) @@ -274,19 +254,7 @@ void RenderManager::AddSampler( Render::Sampler* sampler ) void RenderManager::RemoveSampler( Render::Sampler* sampler ) { - DALI_ASSERT_DEBUG( NULL != sampler ); - - SamplerOwnerContainer& samplers = mImpl->samplerContainer; - - // Find the sampler - for ( SamplerOwnerIter iter = samplers.Begin(); iter != samplers.End(); ++iter ) - { - if ( *iter == sampler ) - { - samplers.Erase( iter ); // Sampler found; now destroy it - break; - } - } + mImpl->samplerContainer.EraseObject( sampler ); } void RenderManager::AddTexture( Render::Texture* texture ) @@ -372,19 +340,7 @@ void RenderManager::AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer ) void RenderManager::RemovePropertyBuffer( Render::PropertyBuffer* propertyBuffer ) { - DALI_ASSERT_DEBUG( NULL != propertyBuffer ); - - PropertyBufferOwnerContainer& propertyBuffers = mImpl->propertyBufferContainer; - - // Find the sampler - for ( PropertyBufferOwnerIter iter = propertyBuffers.Begin(); iter != propertyBuffers.End(); ++iter ) - { - if ( *iter == propertyBuffer ) - { - propertyBuffers.Erase( iter ); // Property buffer found; now destroy it - break; - } - } + mImpl->propertyBufferContainer.EraseObject( propertyBuffer ); } void RenderManager::SetPropertyBufferFormat(Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format ) @@ -409,19 +365,7 @@ void RenderManager::AddGeometry( Render::Geometry* geometry ) void RenderManager::RemoveGeometry( Render::Geometry* geometry ) { - DALI_ASSERT_DEBUG( NULL != geometry ); - - GeometryOwnerContainer& geometries = mImpl->geometryContainer; - - // Find the geometry - for ( GeometryOwnerIter iter = geometries.Begin(); iter != geometries.End(); ++iter ) - { - if ( *iter == geometry ) - { - geometries.Erase( iter ); // Geometry found; now destroy it - break; - } - } + mImpl->geometryContainer.EraseObject( geometry ); } void RenderManager::AddVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ) diff --git a/dali/internal/render/data-providers/property-buffer-data-provider.h b/dali/internal/render/data-providers/property-buffer-data-provider.h index 61e1e30..51c8f64 100644 --- a/dali/internal/render/data-providers/property-buffer-data-provider.h +++ b/dali/internal/render/data-providers/property-buffer-data-provider.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_BUFFER_DATA_PROVIDER_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -22,7 +22,6 @@ // INTERNAL INCLUDES #include -#include #include namespace Dali diff --git a/dali/internal/render/data-providers/uniform-map-data-provider.h b/dali/internal/render/data-providers/uniform-map-data-provider.h index 97bcd39..7d7e120 100644 --- a/dali/internal/render/data-providers/uniform-map-data-provider.h +++ b/dali/internal/render/data-providers/uniform-map-data-provider.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_UNIFORM_MAP_DATA_PROVIDER_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -17,7 +17,6 @@ * limitations under the License. */ #include -#include #include namespace Dali diff --git a/dali/internal/render/gl-resources/context.h b/dali/internal/render/gl-resources/context.h index 28afbfd..59ed396 100644 --- a/dali/internal/render/gl-resources/context.h +++ b/dali/internal/render/gl-resources/context.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_CONTEXT_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -119,7 +119,7 @@ public: */ void PrintGlString(const char* stringName, GLenum stringId) { - DALI_LOG_INFO(Debug::Filter::gRender, Debug::General, "GL %s = %s\n", stringName, (const char *)GetString( stringId ) ); + DALI_LOG_INFO(Debug::Filter::gRender, Debug::General, "GL %s = %s\n", stringName, reinterpret_cast< const char * >( GetString( stringId ) ) ); } /**************************************************************************************** diff --git a/dali/internal/render/renderers/render-frame-buffer.cpp b/dali/internal/render/renderers/render-frame-buffer.cpp index 6281d9b..238a8cf 100644 --- a/dali/internal/render/renderers/render-frame-buffer.cpp +++ b/dali/internal/render/renderers/render-frame-buffer.cpp @@ -85,7 +85,15 @@ void FrameBuffer::AttachColorTexture( Context& context, Render::Texture* texture // Create a color attachment. if( texture->GetType() == TextureType::TEXTURE_2D ) { - context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture->GetId(), mipmapLevel ); + if( !texture->IsNativeImage() ) + { + context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture->GetId(), mipmapLevel ); + } + else + { + // If it's a native image we need to use GL_TEXTURE_EXTERNAL_OES as the texture target parameter + context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_EXTERNAL_OES, texture->GetId(), mipmapLevel ); + } } else { diff --git a/dali/internal/render/renderers/render-frame-buffer.h b/dali/internal/render/renderers/render-frame-buffer.h index 00d2996..942e5b3 100644 --- a/dali/internal/render/renderers/render-frame-buffer.h +++ b/dali/internal/render/renderers/render-frame-buffer.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_RENDER_FRAME_BUFFER_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -22,7 +22,6 @@ #include #include #include -#include namespace Dali { diff --git a/dali/internal/render/renderers/render-property-buffer.cpp b/dali/internal/render/renderers/render-property-buffer.cpp index 6be4623..ccbd2d0 100644 --- a/dali/internal/render/renderers/render-property-buffer.cpp +++ b/dali/internal/render/renderers/render-property-buffer.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #include #include // Dali::Internal::PropertyBuffer @@ -183,7 +199,7 @@ unsigned int PropertyBuffer::EnableVertexAttributes( Context& context, Vector( attributeOffset ) ); } } diff --git a/dali/internal/render/renderers/render-renderer.cpp b/dali/internal/render/renderers/render-renderer.cpp index 97f45ee..593316f 100644 --- a/dali/internal/render/renderers/render-renderer.cpp +++ b/dali/internal/render/renderers/render-renderer.cpp @@ -535,7 +535,7 @@ void Renderer::Render( Context& context, Program* program = mRenderDataProvider->GetShader().GetProgram(); if( !program ) { - DALI_LOG_ERROR( "Failed to get program for shader at address %p.\n", (void*)&mRenderDataProvider->GetShader() ); + DALI_LOG_ERROR( "Failed to get program for shader at address %p.\n", reinterpret_cast< void* >( &mRenderDataProvider->GetShader() ) ); return; } diff --git a/dali/internal/render/renderers/render-texture.h b/dali/internal/render/renderers/render-texture.h index db5988b..e50ec3d 100644 --- a/dali/internal/render/renderers/render-texture.h +++ b/dali/internal/render/renderers/render-texture.h @@ -145,6 +145,15 @@ public: return mType; } + /** + * Check if the texture is a native image + * @return if the texture is a native image + */ + bool IsNativeImage() const + { + return mNativeImage; + } + private: /** @@ -161,7 +170,7 @@ private: NativeImageInterfacePtr mNativeImage; ///< Pointer to native image GLenum mInternalFormat; ///< The format of the pixel data GLenum mPixelDataType; ///< The data type of the pixel data - unsigned int mWidth; ///< Widht of the texture + unsigned int mWidth; ///< Width of the texture unsigned int mHeight; ///< Height of the texture bool mHasAlpha : 1; ///< Whether the format has an alpha channel bool mIsCompressed : 1; ///< Whether the format is compressed diff --git a/dali/internal/render/shaders/program.cpp b/dali/internal/render/shaders/program.cpp index 0f22758..451de0b 100644 --- a/dali/internal/render/shaders/program.cpp +++ b/dali/internal/render/shaders/program.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -258,10 +258,10 @@ void Program::GetActiveSamplerUniforms() for( int i=0; i( i ), uniformMaxNameLength, &nameLength, &number, &type, name ); - if( type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE ) /// Is there a native sampler type? + if( type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES ) { GLuint location = mGlAbstraction.GetUniformLocation( mProgramId, name ); samplerNames.push_back(name); @@ -277,7 +277,9 @@ void Program::GetActiveSamplerUniforms() int samplerPosition = 0; while( token ) { - if( ( strncmp( token, "sampler2D", 9u ) == 0 ) || ( strncmp( token, "samplerCube", 11u ) == 0 ) ) + if( ( strncmp( token, "sampler2D", 9u ) == 0 ) || + ( strncmp( token, "samplerCube", 11u ) == 0 ) || + ( strncmp( token, "samplerExternalOES", 18u ) == 0 ) ) { bool found( false ); token = strtok_r( NULL, " ;\n", &nextPtr ); diff --git a/dali/internal/update/animation/scene-graph-animation.cpp b/dali/internal/update/animation/scene-graph-animation.cpp index 1cf77e5..3f33f3c 100644 --- a/dali/internal/update/animation/scene-graph-animation.cpp +++ b/dali/internal/update/animation/scene-graph-animation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -42,8 +42,14 @@ inline void WrapInPlayRange( float& elapsed, const Dali::Vector2& playRangeSecon } } +/// Compares the end times of the animators and if the end time is less, then it is moved earlier in the list. If end times are the same, then no change. +bool CompareAnimatorEndTimes( const Dali::Internal::SceneGraph::AnimatorBase* lhs, const Dali::Internal::SceneGraph::AnimatorBase* rhs ) +{ + return ( ( lhs->GetInitialDelay() + lhs->GetDuration() ) < ( rhs->GetInitialDelay() + rhs->GetDuration() ) ); } +} // unnamed namespace + namespace Dali { @@ -132,6 +138,9 @@ void Animation::SetPlayRange( const Vector2& range ) void Animation::Play() { + // Sort according to end time with earlier end times coming first, if the end time is the same, then the animators are not moved + std::stable_sort( mAnimators.Begin(), mAnimators.End(), CompareAnimatorEndTimes ); + mState = Playing; if ( mSpeedFactor < 0.0f && mElapsedSeconds <= mPlayRange.x*mDurationSeconds ) diff --git a/dali/internal/update/animation/scene-graph-animator.h b/dali/internal/update/animation/scene-graph-animator.h index b3694b7..3fe041b 100644 --- a/dali/internal/update/animation/scene-graph-animator.h +++ b/dali/internal/update/animation/scene-graph-animator.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_ANIMATOR_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -106,7 +106,7 @@ public: * Retrieve the duration of the animator. * @return The duration in seconds. */ - float GetDuration() + float GetDuration() const { return mDurationSeconds; } @@ -125,7 +125,7 @@ public: * Retrieve the initial delay of the animator. * @return The delay in seconds. */ - float GetInitialDelay() + float GetInitialDelay() const { return mInitialDelaySeconds; } @@ -743,6 +743,7 @@ struct AnimateByInteger : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); float operator()(float alpha, const int& property) { return int(property + mRelative * alpha + 0.5f ); @@ -758,6 +759,7 @@ struct AnimateToInteger : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); float operator()(float alpha, const int& property) { return int(property + ((mTarget - property) * alpha) + 0.5f); @@ -773,6 +775,7 @@ struct AnimateByFloat : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); float operator()(float alpha, const float& property) { return float(property + mRelative * alpha); @@ -788,6 +791,7 @@ struct AnimateToFloat : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); float operator()(float alpha, const float& property) { return float(property + ((mTarget - property) * alpha)); @@ -803,6 +807,7 @@ struct AnimateByVector2 : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector2 operator()(float alpha, const Vector2& property) { return Vector2(property + mRelative * alpha); @@ -818,6 +823,7 @@ struct AnimateToVector2 : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector2 operator()(float alpha, const Vector2& property) { return Vector2(property + ((mTarget - property) * alpha)); @@ -833,6 +839,7 @@ struct AnimateByVector3 : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector3 operator()(float alpha, const Vector3& property) { return Vector3(property + mRelative * alpha); @@ -848,6 +855,7 @@ struct AnimateToVector3 : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector3 operator()(float alpha, const Vector3& property) { return Vector3(property + ((mTarget - property) * alpha)); @@ -863,6 +871,7 @@ struct AnimateByVector4 : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector4 operator()(float alpha, const Vector4& property) { return Vector4(property + mRelative * alpha); @@ -878,6 +887,7 @@ struct AnimateToVector4 : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector4 operator()(float alpha, const Vector4& property) { return Vector4(property + ((mTarget - property) * alpha)); @@ -893,6 +903,7 @@ struct AnimateByOpacity : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector4 operator()(float alpha, const Vector4& property) { Vector4 result(property); @@ -911,6 +922,7 @@ struct AnimateToOpacity : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector4 operator()(float alpha, const Vector4& property) { Vector4 result(property); @@ -929,6 +941,7 @@ struct AnimateByBoolean : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); bool operator()(float alpha, const bool& property) { // Alpha is not useful here, just keeping to the same template as other update functors @@ -945,6 +958,7 @@ struct AnimateToBoolean : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); bool operator()(float alpha, const bool& property) { // Alpha is not useful here, just keeping to the same template as other update functors @@ -962,6 +976,7 @@ struct RotateByAngleAxis : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Quaternion operator()(float alpha, const Quaternion& rotation) { if (alpha > 0.0f) @@ -983,6 +998,7 @@ struct RotateToQuaternion : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Quaternion operator()(float alpha, const Quaternion& rotation) { return Quaternion::Slerp(rotation, mTarget, alpha); @@ -999,6 +1015,7 @@ struct KeyFrameBooleanFunctor : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); bool operator()(float progress, const bool& property) { if(mKeyFrames->IsActive(progress)) @@ -1018,6 +1035,7 @@ struct KeyFrameIntegerFunctor : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); float operator()(float progress, const int& property) { if(mKeyFrames->IsActive(progress)) @@ -1038,6 +1056,7 @@ struct KeyFrameNumberFunctor : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); float operator()(float progress, const float& property) { if(mKeyFrames->IsActive(progress)) @@ -1058,6 +1077,7 @@ struct KeyFrameVector2Functor : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector2 operator()(float progress, const Vector2& property) { if(mKeyFrames->IsActive(progress)) @@ -1079,6 +1099,7 @@ struct KeyFrameVector3Functor : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector3 operator()(float progress, const Vector3& property) { if(mKeyFrames->IsActive(progress)) @@ -1099,6 +1120,7 @@ struct KeyFrameVector4Functor : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector4 operator()(float progress, const Vector4& property) { if(mKeyFrames->IsActive(progress)) @@ -1119,6 +1141,7 @@ struct KeyFrameQuaternionFunctor : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Quaternion operator()(float progress, const Quaternion& property) { if(mKeyFrames->IsActive(progress)) @@ -1138,6 +1161,7 @@ struct PathPositionFunctor : public AnimatorFunctionBase { } + using AnimatorFunctionBase::operator(); Vector3 operator()(float progress, const Vector3& property) { Vector3 position(property); @@ -1157,6 +1181,7 @@ struct PathRotationFunctor : public AnimatorFunctionBase mForward.Normalize(); } + using AnimatorFunctionBase::operator(); Quaternion operator()(float progress, const Quaternion& property) { Vector3 tangent; diff --git a/dali/internal/update/common/property-owner.h b/dali/internal/update/common/property-owner.h index 3df069b..fa7bf46 100644 --- a/dali/internal/update/common/property-owner.h +++ b/dali/internal/update/common/property-owner.h @@ -76,6 +76,14 @@ public: * may not be called (i.e. when shutting down). */ virtual void PropertyOwnerDestroyed( PropertyOwner& owner ) = 0; + + protected: + + /** + * Virtual destructor, no deletion through this interface + */ + virtual ~Observer() {} + }; /** diff --git a/dali/internal/update/common/scene-graph-connection-change-propagator.h b/dali/internal/update/common/scene-graph-connection-change-propagator.h index 65e49fc..91b1a04 100644 --- a/dali/internal/update/common/scene-graph-connection-change-propagator.h +++ b/dali/internal/update/common/scene-graph-connection-change-propagator.h @@ -53,6 +53,14 @@ public: * Inform the observer of the object that the object is about to be destroyed */ virtual void ObservedObjectDestroyed(PropertyOwner& object){} + + protected: + + /** + * Virtual destructor, no deletion through this interface + */ + virtual ~Observer() {} + }; /** diff --git a/dali/internal/update/common/uniform-map.h b/dali/internal/update/common/uniform-map.h index d34c014..9b5bb4c 100644 --- a/dali/internal/update/common/uniform-map.h +++ b/dali/internal/update/common/uniform-map.h @@ -74,7 +74,19 @@ public: class Observer { public: + + /** + * Inform observer that uniform mappings have been changed + * @param mappings + */ virtual void UniformMappingsChanged(const UniformMap& mappings) = 0; + + protected: + + /** + * Virtual destructor, no deletion through this interface + */ + virtual ~Observer() {} }; /** diff --git a/dali/internal/update/gestures/scene-graph-pan-gesture.cpp b/dali/internal/update/gestures/scene-graph-pan-gesture.cpp index 596a391..6218102 100644 --- a/dali/internal/update/gestures/scene-graph-pan-gesture.cpp +++ b/dali/internal/update/gestures/scene-graph-pan-gesture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -137,7 +137,7 @@ void PanGesture::PredictiveAlgorithm1(int eventsThisFrame, PanInfo& gestureOut, ++iter; continue; } - float previousValueWeight = (float)(MAX_GESTURE_AGE - (lastVSyncTime - lastTime)) / (float)MAX_GESTURE_AGE; + float previousValueWeight = ( static_cast< float >( MAX_GESTURE_AGE ) - (lastVSyncTime - lastTime) ) / static_cast< float >( MAX_GESTURE_AGE ); float velMag = currentGesture.screen.velocity.Length(); float velDiff = velMag - screenVelocity.Length(); float acceleration = 0.0f; diff --git a/dali/internal/update/manager/render-instruction-processor.h b/dali/internal/update/manager/render-instruction-processor.h index ecdb451..95cc818 100644 --- a/dali/internal/update/manager/render-instruction-processor.h +++ b/dali/internal/update/manager/render-instruction-processor.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_PROCESSOR_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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,6 @@ // INTERNAL INCLUDES #include #include -#include #include namespace Dali diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index 0fcddea..e90123e 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -126,6 +126,8 @@ inline void ResetToBaseValues( OwnerContainer& container, BufferIndex update template < class T > inline void EraseUsingDiscardQueue( OwnerContainer& container, T* object, DiscardQueue& discardQueue, BufferIndex updateBufferIndex ) { + DALI_ASSERT_DEBUG( object && "NULL object not allowed" ); + typename OwnerContainer::Iterator iter = container.Begin(); const typename OwnerContainer::ConstIterator endIter = container.End(); for ( ; iter != endIter; ++iter ) @@ -434,23 +436,7 @@ void UpdateManager::AddObject( PropertyOwner* object ) void UpdateManager::RemoveObject( PropertyOwner* object ) { - DALI_ASSERT_DEBUG( NULL != object ); - - OwnerContainer< PropertyOwner* >& customObjects = mImpl->customObjects; - - // Find the object and destroy it - for ( OwnerContainer< PropertyOwner* >::Iterator iter = customObjects.Begin(); iter != customObjects.End(); ++iter ) - { - PropertyOwner* current = *iter; - if ( current == object ) - { - customObjects.Erase( iter ); - return; - } - } - - // Should not reach here - DALI_ASSERT_DEBUG(false); + mImpl->customObjects.EraseObject( object ); } void UpdateManager::AddAnimation( Animation* animation ) @@ -505,18 +491,7 @@ void UpdateManager::AddPropertyNotification( PropertyNotification* propertyNotif void UpdateManager::RemovePropertyNotification( PropertyNotification* propertyNotification ) { - PropertyNotificationContainer &propertyNotifications = mImpl->propertyNotifications; - PropertyNotificationIter iter = propertyNotifications.Begin(); - - while ( iter != propertyNotifications.End() ) - { - if( *iter == propertyNotification ) - { - propertyNotifications.Erase(iter); - break; - } - ++iter; - } + mImpl->propertyNotifications.EraseObject( propertyNotification ); } void UpdateManager::PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode ) @@ -534,8 +509,6 @@ void UpdateManager::AddShader( Shader* shader ) void UpdateManager::RemoveShader( Shader* shader ) { - DALI_ASSERT_DEBUG(shader != NULL); - // Find the shader and destroy it EraseUsingDiscardQueue( mImpl->shaders, shader, mImpl->discardQueue, mSceneGraphBuffers.GetUpdateBufferIndex() ); } @@ -583,12 +556,10 @@ void UpdateManager::AddRenderer( Renderer* renderer ) void UpdateManager::RemoveRenderer( Renderer* renderer ) { - DALI_ASSERT_DEBUG( renderer != NULL ); - - renderer->DisconnectFromSceneGraph( *mImpl->sceneController, mSceneGraphBuffers.GetUpdateBufferIndex() ); - // Find the renderer and destroy it EraseUsingDiscardQueue( mImpl->renderers, renderer, mImpl->discardQueue, mSceneGraphBuffers.GetUpdateBufferIndex() ); + // Need to remove the render object as well + renderer->DisconnectFromSceneGraph( *mImpl->sceneController, mSceneGraphBuffers.GetUpdateBufferIndex() ); } void UpdateManager::SetPanGestureProcessor( PanGesture* panGestureProcessor ) @@ -601,23 +572,13 @@ void UpdateManager::SetPanGestureProcessor( PanGesture* panGestureProcessor ) void UpdateManager::AddTextureSet( TextureSet* textureSet ) { DALI_ASSERT_DEBUG( NULL != textureSet ); + mImpl->textureSets.PushBack( textureSet ); } void UpdateManager::RemoveTextureSet( TextureSet* textureSet ) { - DALI_ASSERT_DEBUG( textureSet != NULL ); - - // Find the texture and destroy it - TextureSetOwner& textures = mImpl->textureSets; - for ( TextureSetIter iter = textures.Begin(), endIter = textures.End(); iter != endIter; ++iter ) - { - if ( *iter == textureSet ) - { - textures.Erase( iter ); - return; - } - } + mImpl->textureSets.EraseObject( textureSet ); } RenderTaskList* UpdateManager::GetRenderTaskList( bool systemLevel ) diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index 6496987..4f92d2c 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -22,8 +22,6 @@ #include #include -#include - #include #include #include diff --git a/dali/public-api/animation/animation.h b/dali/public-api/animation/animation.h index 34ced29..29160c3 100644 --- a/dali/public-api/animation/animation.h +++ b/dali/public-api/animation/animation.h @@ -2,7 +2,7 @@ #define __DALI_ANIMATION_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -100,6 +100,10 @@ class Animation; * The overall animation time is superseded by the values given in the TimePeriod structure used when calling the AnimateTo(), AnimateBy(), AnimateBetween() and Animate() methods. * If any of the individual calls to those functions exceeds the overall animation time, then the overall animation time is automatically extended. * + * Using AnimateTo and AnimateBy for the same property of the same Actor will yield undefined behaviour especially if the TimePeriod overlaps. + * + * After calling Animation::Play(), Handle::GetProperty will return the target value of the animated property. + * * Signals * | %Signal Name | Method | * |--------------|--------------------------| diff --git a/dali/public-api/common/dali-common.cpp b/dali/public-api/common/dali-common.cpp index c2c16cc..78dd20d 100644 --- a/dali/public-api/common/dali-common.cpp +++ b/dali/public-api/common/dali-common.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -69,7 +69,7 @@ std::string Demangle(const char* symbol) size_t tokenLength = endOfToken - startOfToken; // Allocate space for symbol - char *mangledSymbol = (char*)malloc(tokenLength+1u); + char *mangledSymbol = reinterpret_cast< char* >( malloc( tokenLength + 1u ) ); if(mangledSymbol != NULL) { strncpy(mangledSymbol, startOfToken, tokenLength); diff --git a/dali/public-api/common/dali-vector.cpp b/dali/public-api/common/dali-vector.cpp index 9dd7d8c..2e2bd8f 100644 --- a/dali/public-api/common/dali-vector.cpp +++ b/dali/public-api/common/dali-vector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -75,7 +75,7 @@ void VectorBase::Reserve( SizeType capacity, SizeType elementSize ) if( capacity > oldCapacity ) { const SizeType wholeAllocation = sizeof(SizeType) * 2u + capacity * elementSize; - void* wholeData = (void*) new unsigned char[ wholeAllocation ]; + void* wholeData = reinterpret_cast< void* >( new unsigned char[ wholeAllocation ] ); DALI_ASSERT_ALWAYS( wholeData && "VectorBase::Reserve - Memory allocation failed" ); #if defined( DEBUG_ENABLED ) diff --git a/dali/public-api/dali-core-version.cpp b/dali/public-api/dali-core-version.cpp index 2916302..06b2002 100644 --- a/dali/public-api/dali-core-version.cpp +++ b/dali/public-api/dali-core-version.cpp @@ -28,7 +28,7 @@ namespace Dali const unsigned int CORE_MAJOR_VERSION = 1; const unsigned int CORE_MINOR_VERSION = 2; -const unsigned int CORE_MICRO_VERSION = 39; +const unsigned int CORE_MICRO_VERSION = 40; const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__; #ifndef EMSCRIPTEN diff --git a/dali/public-api/math/quaternion.cpp b/dali/public-api/math/quaternion.cpp index cfa8fa9..19546b4 100644 --- a/dali/public-api/math/quaternion.cpp +++ b/dali/public-api/math/quaternion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -302,12 +302,12 @@ bool Quaternion::operator!=( const Quaternion& rhs ) const float Quaternion::Length() const { - return (float)sqrt(mVector.w * mVector.w + mVector.Dot(mVector)); + return static_cast< float >( sqrt(mVector.w * mVector.w + mVector.Dot(mVector) ) ); } float Quaternion::LengthSquared() const { - return (float)(mVector.w * mVector.w + mVector.Dot(mVector)); + return static_cast< float >( mVector.w * mVector.w + mVector.Dot(mVector) ); } void Quaternion::Normalize() diff --git a/packaging/dali.spec b/packaging/dali.spec index 5df2fbf..ca60b49 100644 --- a/packaging/dali.spec +++ b/packaging/dali.spec @@ -1,6 +1,6 @@ Name: dali Summary: The OpenGLES Canvas Core Library -Version: 1.2.39 +Version: 1.2.40 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT