X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fcube-transition-effect%2Fcube-transition-effect-example.cpp;h=7f50537be878d24ea799b693dbc06c48fd9cdf65;hb=ff961cccdcbf1c30b0f53b0da027df855cde2b63;hp=46d7fcd8db0a046c931d1a1419245b3dfdc9e07e;hpb=cfc43aa4674b518344647bae3e78b19f89a09b63;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/cube-transition-effect/cube-transition-effect-example.cpp b/examples/cube-transition-effect/cube-transition-effect-example.cpp index 46d7fcd..7f50537 100644 --- a/examples/cube-transition-effect/cube-transition-effect-example.cpp +++ b/examples/cube-transition-effect/cube-transition-effect-example.cpp @@ -20,6 +20,7 @@ // INTERNAL INCLUDES #include "shared/view.h" +#include "shared/utility.h" #include #include @@ -98,20 +99,6 @@ const float CUBE_DISPLACEMENT_CROSS(30.f); // The duration of the current image staying on screen when slideshow is on const int VIEWINGTIME = 2000; // 2 seconds -/** - * @brief Load an image, scaled-down to no more than the stage dimensions. - * - * Uses image scaling mode SCALE_TO_FILL to resize the image at - * load time to cover the entire stage with pixels with no borders, - * and filter mode BOX_THEN_LINEAR to sample the image with - * maximum quality. - */ -ResourceImage LoadStageFillingImage( const char * const imagePath ) -{ - Size stageSize = Stage::GetCurrent().GetSize(); - return ResourceImage::New( imagePath, ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); -} - } // namespace class CubeTransitionApp : public ConnectionTracker @@ -143,12 +130,6 @@ private: */ void GoToNextImage(); /** - * Callback function of image resource loading succeed - * Start the transition - * @param[in] image The image content of the imageActor for transition - */ - void OnImageLoaded(ResourceImage image); - /** * Main key event handler */ void OnKeyEvent(const KeyEvent& event); @@ -185,8 +166,8 @@ private: Vector2 mViewSize; - ResourceImage mCurrentImage; - ResourceImage mNextImage; + Image mCurrentImage; + Image mNextImage; unsigned int mIndex; bool mIsImageLoading; @@ -251,7 +232,7 @@ void CubeTransitionApp::OnInit( Application& application ) mViewSize = Stage::GetCurrent().GetSize(); // show the first image - mCurrentImage = LoadStageFillingImage( IMAGES[mIndex] ); + mCurrentImage = DemoHelper::LoadStageFillingImage( IMAGES[mIndex] ); //use small cubes mCubeWaveEffect = Toolkit::CubeTransitionWaveEffect::New( NUM_ROWS_WAVE, NUM_COLUMNS_WAVE ); @@ -322,25 +303,11 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) void CubeTransitionApp::GoToNextImage() { - mNextImage = LoadStageFillingImage( IMAGES[ mIndex ] ); + mNextImage = DemoHelper::LoadStageFillingImage( IMAGES[ mIndex ] ); mCurrentEffect.SetTargetImage( mNextImage ); - if( mNextImage.GetLoadingState() == ResourceLoadingSucceeded ) - { - mIsImageLoading = false; - OnImageLoaded( mNextImage ); - } - else - { - mIsImageLoading = true; - mNextImage.LoadingFinishedSignal().Connect( this, &CubeTransitionApp::OnImageLoaded ); - } -} - -void CubeTransitionApp::OnImageLoaded(ResourceImage image) -{ - mIsImageLoading = false; - mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement ); - mCurrentImage = mNextImage; + mIsImageLoading = false; + mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement ); + mCurrentImage = mNextImage; } bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button )