From: Adeel Kazmi Date: Thu, 6 Nov 2014 08:57:49 +0000 (-0800) Subject: Merge "Alignment: To use default copy constructor in the constraints" into tizen X-Git-Tag: dali_1.0.17~12 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=c1c78b1b64e484e60c510afba57f05c2051f8e5d;hp=00b235134cddc3212e449dff3153c94f523c78aa Merge "Alignment: To use default copy constructor in the constraints" into tizen --- diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Button.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Button.cpp index 4d85f3f..e566cbd 100644 --- a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Button.cpp +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Button.cpp @@ -66,7 +66,7 @@ int UtcDaliButtonNew(void) CheckBoxButton checkBoxButton2( checkBoxButton ); DALI_TEST_CHECK( checkBoxButton2 ); - checkBoxButton2 = NULL; + checkBoxButton2.Reset(); //Additional check to ensure object is created by checking if it's registered diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CubeTransitionEffect.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CubeTransitionEffect.cpp index 71fc956..e584bb4 100644 --- a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CubeTransitionEffect.cpp +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-CubeTransitionEffect.cpp @@ -121,7 +121,7 @@ int UtcDaliCubeTransitionWaveEffectNew(void) DALI_TEST_CHECK( waveEffect ); - waveEffect = NULL; + waveEffect.Reset(); //Additional check to ensure object is created by checking if it's registered ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); @@ -149,7 +149,7 @@ int UtcDaliCubeTransitionCrossEffectNew(void) DALI_TEST_CHECK( crossEffect ); - crossEffect = NULL; + crossEffect.Reset(); //Additional check to ensure object is created by checking if it's registered ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); @@ -177,7 +177,7 @@ int UtcDaliCubeTransitionFoldEffectNew(void) DALI_TEST_CHECK( foldEffect ); - foldEffect = NULL; + foldEffect.Reset(); //Additional check to ensure object is created by checking if it is registered ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-KeyInputFocusManager.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-KeyInputFocusManager.cpp index ab377f6..be76927 100644 --- a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-KeyInputFocusManager.cpp +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-KeyInputFocusManager.cpp @@ -618,14 +618,16 @@ int UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged(void) DALI_TEST_CHECK( gainActor == pushButton1 ); DALI_TEST_CHECK( lostActor == Control() ); - gainActor = lostActor = NULL; + gainActor.Reset(); + lostActor.Reset(); manager.SetFocus(pushButton2); DALI_TEST_CHECK( gainActor == pushButton2 ); DALI_TEST_CHECK( lostActor == pushButton1 ); - gainActor = lostActor = NULL; + gainActor.Reset(); + lostActor.Reset(); // Removing the focus actor from the stage would also result in signal emission. stage.Remove( pushButton1 ); diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-View.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-View.cpp index c731668..f9fc731 100644 --- a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-View.cpp +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-View.cpp @@ -73,9 +73,9 @@ int UtcDaliViewNew(void) View view3 = view2; DALI_TEST_CHECK( view3 ); - view1 = NULL; - view2 = NULL; - view3 = NULL; + view1.Reset(); + view2.Reset(); + view3.Reset(); //Additional check to ensure object is created by checking if it's registered ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp index c2680b2..89138eb 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp @@ -24,13 +24,15 @@ namespace Dali TestApplication::TestApplication( size_t surfaceWidth, size_t surfaceHeight, float horizontalDpi, - float verticalDpi) + float verticalDpi, + ResourcePolicy::DataRetention policy) : mCore( NULL ), mSurfaceWidth( surfaceWidth ), mSurfaceHeight( surfaceHeight ), mFrame( 0u ), mDpi( horizontalDpi, verticalDpi ), - mLastVSyncTime(0u) + mLastVSyncTime(0u), + mDataRetentionPolicy( policy ) { Initialize(); } @@ -39,12 +41,14 @@ TestApplication::TestApplication( bool initialize, size_t surfaceWidth, size_t surfaceHeight, float horizontalDpi, - float verticalDpi ) + float verticalDpi, + ResourcePolicy::DataRetention policy) : mCore( NULL ), mSurfaceWidth( surfaceWidth ), mSurfaceHeight( surfaceHeight ), mFrame( 0u ), - mDpi( horizontalDpi, verticalDpi ) + mDpi( horizontalDpi, verticalDpi ), + mDataRetentionPolicy( policy ) { if ( initialize ) { @@ -59,7 +63,8 @@ void TestApplication::Initialize() mPlatformAbstraction, mGlAbstraction, mGlSyncAbstraction, - mGestureManager ); + mGestureManager, + mDataRetentionPolicy); mCore->ContextCreated(); mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); @@ -190,7 +195,7 @@ bool TestApplication::RenderOnly( ) void TestApplication::ResetContext() { - mCore->ContextToBeDestroyed(); + mCore->ContextDestroyed(); mCore->ContextCreated(); } diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h index bcc2dd8..d3bf259 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h @@ -50,13 +50,17 @@ public: TestApplication( size_t surfaceWidth = DEFAULT_SURFACE_WIDTH, size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, float horizontalDpi = DEFAULT_HORIZONTAL_DPI, - float verticalDpi = DEFAULT_VERTICAL_DPI ); + float verticalDpi = DEFAULT_VERTICAL_DPI, + ResourcePolicy::DataRetention resourcePolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA ); + + TestApplication( bool initialize, size_t surfaceWidth = DEFAULT_SURFACE_WIDTH, size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT, float horizontalDpi = DEFAULT_HORIZONTAL_DPI, - float verticalDpi = DEFAULT_VERTICAL_DPI ); + float verticalDpi = DEFAULT_VERTICAL_DPI, + ResourcePolicy::DataRetention resourcePolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA ); void Initialize(); virtual ~TestApplication(); @@ -97,6 +101,7 @@ protected: Vector2 mDpi; unsigned int mLastVSyncTime; + ResourcePolicy::DataRetention mDataRetentionPolicy; }; } // Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp index ef3eb77..aa1b5b2 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp @@ -227,7 +227,7 @@ Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration if( getBitmap ) { - bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true); + bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD); bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64); PixelBuffer* pixelBuffer = bitmapData->GetBuffer(); memset( pixelBuffer, it->character, 64*64 ); @@ -268,7 +268,7 @@ Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integr characters.insert( it->character ); Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::HIGH_QUALITY, 10.0f, 10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition }; - bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true); + bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD); bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64); PixelBuffer* pixelBuffer = bitmapData->GetBuffer(); memset( pixelBuffer, it->character, 64*64 ); @@ -455,7 +455,7 @@ void TestPlatformAbstraction::GetFileNamesFromDirectory( const std::string& dire Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const { - Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true ); + Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD ); image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 ); mTrace.PushCall("GetGlyphImage", ""); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp index fd5c491..b0dd81d 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp @@ -76,7 +76,7 @@ int UtcDaliButtonNew(void) DALI_TEST_CHECK( pushButton2 ); - pushButton2 = NULL; + pushButton2.Reset(); // Test down cast Handle handleButton; diff --git a/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp b/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp index 62ef78d..787f842 100644 --- a/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp +++ b/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp @@ -42,6 +42,7 @@ BubbleEmitter::BubbleEmitter( const Vector2& movementArea, mMovementArea( movementArea ), mShapeImage( shapeImage ), mTotalNumOfBubble( maximumNumberOfBubble ), + mRenderTaskRunning(false), mBubbleSizeRange( bubbleSizeRange ), mCurrentUniform( 0 ), mDensity( 5 ) @@ -129,7 +130,11 @@ void BubbleEmitter::OnInitialize() // Create a cameraActor for the off screen render task. mCameraActor = CameraActor::New(mMovementArea); mCameraActor.SetParentOrigin(ParentOrigin::CENTER); - Stage::GetCurrent().Add(mCameraActor); + + Stage stage = Stage::GetCurrent(); + + stage.Add(mCameraActor); + stage.ContextRegainedSignal().Connect(this, &BubbleEmitter::OnContextRegained); } Actor BubbleEmitter::GetRootActor() @@ -139,6 +144,9 @@ Actor BubbleEmitter::GetRootActor() void BubbleEmitter::SetBackground( Image bgImage, const Vector3& hsvDelta ) { + mBackgroundImage = bgImage; + mHSVDelta = hsvDelta; + ImageActor sourceActor = ImageActor::New( bgImage ); sourceActor.SetSize( mMovementArea ); sourceActor.SetParentOrigin(ParentOrigin::CENTER); @@ -156,6 +164,7 @@ void BubbleEmitter::SetBackground( Image bgImage, const Vector3& hsvDelta ) task.GetCameraActor().SetInvertYAxis(true); task.SetTargetFrameBuffer( mEffectImage ); task.FinishedSignal().Connect(this, &BubbleEmitter::OnRenderFinished); + mRenderTaskRunning = true; } void BubbleEmitter::SetShapeImage( Image shapeImage ) @@ -204,6 +213,7 @@ void BubbleEmitter::SetBubbleDensity( unsigned int density ) // clear the resources created for the off screen rendering void BubbleEmitter::OnRenderFinished(RenderTask& source) { + mRenderTaskRunning = false; Actor sourceActor = source.GetSourceActor(); if( sourceActor ) { @@ -213,8 +223,20 @@ void BubbleEmitter::OnRenderFinished(RenderTask& source) renderable.RemoveShaderEffect(); } } - Stage::GetCurrent().Remove(sourceActor); - Stage::GetCurrent().GetRenderTaskList().RemoveTask(source); + + Stage stage = Stage::GetCurrent(); + stage.Remove(sourceActor); + stage.GetRenderTaskList().RemoveTask(source); +} + +void BubbleEmitter::OnContextRegained() +{ + // Context was lost, so the framebuffer has been destroyed. Re-create render task + // and trigger re-draw if not already running + if( ! mRenderTaskRunning ) + { + SetBackground( mBackgroundImage, mHSVDelta ); + } } void BubbleEmitter::SetBlendMode( bool enable ) diff --git a/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.h b/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.h index f8952af..30ed0a0 100644 --- a/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.h +++ b/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.h @@ -135,6 +135,11 @@ private: void OnRenderFinished(RenderTask& source); /** + * Callback function from Stage to tell us if the context has been regained. + */ + void OnContextRegained(); + + /** * Generate the material object which is attached to the meshActor to describe its color, texture, texture mapping mode etc. */ void GenMaterial(); @@ -207,6 +212,8 @@ private: unsigned int mNumBubblePerShader; ///< How many bubbles for each BubbleEffect shader. unsigned int mNumShader; ///< How many BubbleEffect shaders are used. unsigned int mTotalNumOfBubble; ///< mNumBubblePerShader*mNumShader. + bool mRenderTaskRunning; ///< If the background render task is currently running + Vector2 mBubbleSizeRange; ///< The bubble size range. std::vector mMesh; ///< The mesh vector, each mesh is used to create a meshActor which applies a BubbleEffect. @@ -219,6 +226,8 @@ private: unsigned int mCurrentUniform; ///< Keep track of the uniform index for the newly emitted bubble + Vector3 mHSVDelta; ///< The HSV difference used to adjust the background image color. + Image mBackgroundImage; ///< The original background image FrameBufferImage mEffectImage; ///< The image stores the adjusted color of the background image.The bubbles pick color from this image. CameraActor mCameraActor; ///< The render task views the scene from the perspective of this actor. diff --git a/optional/dali-toolkit/public-api/dali-toolkit-version.cpp b/optional/dali-toolkit/public-api/dali-toolkit-version.cpp index b3605e7..b0849b0 100644 --- a/optional/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/optional/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 0; -const unsigned int TOOLKIT_MICRO_VERSION = 15; +const unsigned int TOOLKIT_MICRO_VERSION = 16; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index ba07934..deabf5c 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: The OpenGLES Canvas Core Library Toolkit -Version: 1.0.15 +Version: 1.0.16 Release: 1 Group: System/Libraries License: Apache-2.0