Commit 0d37451a565110ba6615420ea6827e7cda08db61
1 parent
ba018272
Changed benchmark to use ImageView by default
-ImageView is used by default -ImageActor can still be used if the command line option "--use-image-actor" is specified -Fixed bug on HideAnimation Change-Id: Ib9664b7a99a142681bfdbe9ebb3ab457069d6cf7
Showing
1 changed file
with
31 additions
and
30 deletions
examples/benchmark/benchmark.cpp
| ... | ... | @@ -207,7 +207,7 @@ Geometry& QuadMesh() |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | bool gUseMesh(false); |
| 210 | -bool gUseImageView(false); | |
| 210 | +bool gUseImageActor(false); | |
| 211 | 211 | bool gNinePatch(false); |
| 212 | 212 | unsigned int gRowsPerPage(25); |
| 213 | 213 | unsigned int gColumnsPerPage( 25 ); |
| ... | ... | @@ -243,11 +243,11 @@ Actor CreateMeshActor( unsigned int index) |
| 243 | 243 | |
| 244 | 244 | } |
| 245 | 245 | // Test application to compare performance between ImageActor and ImageView |
| 246 | -// By default, the application consist of 10 pages of 25x25 ImageActors, this can be modified using the following command line arguments: | |
| 246 | +// By default, the application consist of 10 pages of 25x25 Image views, this can be modified using the following command line arguments: | |
| 247 | 247 | // -r NumberOfRows (Modifies the number of rows per page) |
| 248 | 248 | // -c NumberOfColumns (Modifies the number of columns per page) |
| 249 | 249 | // -p NumberOfPages (Modifies the nimber of pages ) |
| 250 | -// --use-imageview ( Use ImageView instead of ImageActor ) | |
| 250 | +// --use-image-actor ( Use ImageActor instead of ImageView ) | |
| 251 | 251 | // --use-mesh ( Use new renderer API (as ImageView) but shares renderers between actors when possible ) |
| 252 | 252 | // --nine-patch ( Use nine patch images ) |
| 253 | 253 | |
| ... | ... | @@ -290,13 +290,13 @@ public: |
| 290 | 290 | { |
| 291 | 291 | CreateMeshActors(); |
| 292 | 292 | } |
| 293 | - else if( gUseImageView ) | |
| 293 | + else if( gUseImageActor ) | |
| 294 | 294 | { |
| 295 | - CreateImageViews(); | |
| 295 | + CreateImageActors(); | |
| 296 | 296 | } |
| 297 | 297 | else |
| 298 | 298 | { |
| 299 | - CreateImageActors(); | |
| 299 | + CreateImageViews(); | |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | ShowAnimation(); |
| ... | ... | @@ -406,15 +406,7 @@ public: |
| 406 | 406 | duration = durationPerActor; |
| 407 | 407 | delay = delayBetweenActors * count; |
| 408 | 408 | } |
| 409 | - if( gUseImageView ) | |
| 410 | - { | |
| 411 | - mImageView[count].SetPosition( initialPosition ); | |
| 412 | - mImageView[count].SetSize( Vector3(0.0f,0.0f,0.0f) ); | |
| 413 | - mImageView[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS)); | |
| 414 | - mShow.AnimateTo( Property( mImageView[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration )); | |
| 415 | - mShow.AnimateTo( Property( mImageView[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration )); | |
| 416 | - } | |
| 417 | - else | |
| 409 | + if( gUseImageActor || gUseMesh ) | |
| 418 | 410 | { |
| 419 | 411 | mActor[count].SetPosition( initialPosition ); |
| 420 | 412 | mActor[count].SetSize( Vector3(0.0f,0.0f,0.0f) ); |
| ... | ... | @@ -422,6 +414,14 @@ public: |
| 422 | 414 | mShow.AnimateTo( Property( mActor[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration )); |
| 423 | 415 | mShow.AnimateTo( Property( mActor[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration )); |
| 424 | 416 | } |
| 417 | + else | |
| 418 | + { | |
| 419 | + mImageView[count].SetPosition( initialPosition ); | |
| 420 | + mImageView[count].SetSize( Vector3(0.0f,0.0f,0.0f) ); | |
| 421 | + mImageView[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS)); | |
| 422 | + mShow.AnimateTo( Property( mImageView[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration )); | |
| 423 | + mShow.AnimateTo( Property( mImageView[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration )); | |
| 424 | + } | |
| 425 | 425 | ++count; |
| 426 | 426 | } |
| 427 | 427 | } |
| ... | ... | @@ -438,20 +438,20 @@ public: |
| 438 | 438 | size_t actorCount( mRowsPerPage*mColumnsPerPage*mPageCount); |
| 439 | 439 | for( size_t i(0); i<actorCount; ++i ) |
| 440 | 440 | { |
| 441 | - if( gUseImageView ) | |
| 442 | - { | |
| 443 | - mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f)); | |
| 444 | - mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f)); | |
| 445 | - mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f)); | |
| 446 | - mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f)); | |
| 447 | - } | |
| 448 | - else | |
| 441 | + if( gUseImageActor || gUseMesh ) | |
| 449 | 442 | { |
| 450 | 443 | mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f)); |
| 451 | 444 | mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f)); |
| 452 | 445 | mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f)); |
| 453 | 446 | mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f)); |
| 454 | 447 | } |
| 448 | + else | |
| 449 | + { | |
| 450 | + mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f)); | |
| 451 | + mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f)); | |
| 452 | + mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f)); | |
| 453 | + mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f)); | |
| 454 | + } | |
| 455 | 455 | } |
| 456 | 456 | mScroll.Play(); |
| 457 | 457 | mScroll.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd ); |
| ... | ... | @@ -465,6 +465,7 @@ public: |
| 465 | 465 | |
| 466 | 466 | unsigned int totalColumns = mColumnsPerPage * mPageCount; |
| 467 | 467 | |
| 468 | + float finalZ = Dali::Stage::GetCurrent().GetRenderTaskList().GetTask(0).GetCameraActor().GetCurrentWorldPosition().z; | |
| 468 | 469 | float totalDuration( 5.0f); |
| 469 | 470 | float durationPerActor( 0.5f ); |
| 470 | 471 | float delayBetweenActors = ( totalDuration - durationPerActor) / (mRowsPerPage*mColumnsPerPage); |
| ... | ... | @@ -480,15 +481,15 @@ public: |
| 480 | 481 | delay = delayBetweenActors * count; |
| 481 | 482 | } |
| 482 | 483 | |
| 483 | - if( gUseImageView ) | |
| 484 | + if( gUseImageActor || gUseMesh ) | |
| 484 | 485 | { |
| 485 | - mHide.AnimateTo( Property( mImageView[count], Actor::Property::ORIENTATION), Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration )); | |
| 486 | - mHide.AnimateBy( Property( mImageView[count], Actor::Property::POSITION_Z), 1000.0f, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration )); | |
| 486 | + mHide.AnimateTo( Property( mActor[count], Actor::Property::ORIENTATION), Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration )); | |
| 487 | + mHide.AnimateBy( Property( mActor[count], Actor::Property::POSITION_Z), finalZ, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration )); | |
| 487 | 488 | } |
| 488 | 489 | else |
| 489 | 490 | { |
| 490 | - mHide.AnimateTo( Property( mActor[count], Actor::Property::ORIENTATION), Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration )); | |
| 491 | - mHide.AnimateBy( Property( mActor[count], Actor::Property::POSITION_Z), 1000.0f, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration )); | |
| 491 | + mHide.AnimateTo( Property( mImageView[count], Actor::Property::ORIENTATION), Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration )); | |
| 492 | + mHide.AnimateBy( Property( mImageView[count], Actor::Property::POSITION_Z), finalZ, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration )); | |
| 492 | 493 | } |
| 493 | 494 | ++count; |
| 494 | 495 | } |
| ... | ... | @@ -534,9 +535,9 @@ int main( int argc, char **argv ) |
| 534 | 535 | { |
| 535 | 536 | gUseMesh = true; |
| 536 | 537 | } |
| 537 | - else if( arg.compare("--use-imageview") == 0) | |
| 538 | + else if( arg.compare("--use-image-actor") == 0) | |
| 538 | 539 | { |
| 539 | - gUseImageView = true; | |
| 540 | + gUseImageActor = true; | |
| 540 | 541 | } |
| 541 | 542 | else if( arg.compare("--nine-patch" ) == 0) |
| 542 | 543 | { | ... | ... |