/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Wait(application);
DALI_TEST_EQUALS(blurView.GetRendererCount(), BLUR_LEVELS+1, TEST_LOCATION );
- application.SendNotification();
- application.Render();
+ Wait(application);
+ Stage::GetCurrent().Remove( blurView );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliSuperBlurViewSetImage2(void)
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliSuperBlurViewSetImage2 - test setting a second image ");
+
+ SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS );
+ blurView.SetSize( 100.f, 100.f );
+
+ tet_infoline("Call SetImage and add blurview to stage");
+ Image inputImage = CreateSolidColorImage( application, Color::GREEN, 50, 50 );
+ blurView.SetImage( inputImage );
+
+ // start multiple guassian blur call, each guassian blur creates two render tasks
+ DALI_TEST_CHECK( Stage::GetCurrent().GetRenderTaskList().GetTaskCount() == 1+BLUR_LEVELS*2);
+ {
+ // create image renderers for the original image and each blurred image
+ stage.Add( blurView );
+ Wait(application);
+ DALI_TEST_EQUALS(blurView.GetRendererCount(), BLUR_LEVELS+1, TEST_LOCATION );
+
+ tet_infoline("Wait for a second to allow blur to finish");
+ Wait(application, 1000);
+
+ tet_infoline("Remove from stage");
Stage::GetCurrent().Remove( blurView );
}
+ tet_infoline("Test that there are no render tasks remaining");
+ DALI_TEST_EQUALS(blurView.GetRendererCount(), 0, TEST_LOCATION );
+
+ tet_infoline("Call SetImage a second time and add blurview back to stage");
+ Image inputImage2 = CreateSolidColorImage( application, Color::CYAN, 50, 50 );
+ blurView.SetImage( inputImage2 );
+ // start multiple guassian blur call, each guassian blur creates two render tasks
+ DALI_TEST_CHECK( Stage::GetCurrent().GetRenderTaskList().GetTaskCount() == 1+BLUR_LEVELS*2);
+
+ {
+ // create image renderers for the original image and each blurred image
+ Stage::GetCurrent().Add( blurView );
+ Wait(application);
+ DALI_TEST_EQUALS(blurView.GetRendererCount(), BLUR_LEVELS+1, TEST_LOCATION );
+
+ tet_infoline("Wait for a second to allow blur to finish");
+ Wait(application, 1000);
+
+ tet_infoline("Remove from stage");
+ Stage::GetCurrent().Remove( blurView );
+ }
+
+ tet_infoline("Test that there are no render tasks remaining");
+ DALI_TEST_EQUALS(blurView.GetRendererCount(), 0, TEST_LOCATION );
+
END_TEST;
}
+
int UtcDaliSuperBlurViewSetProperty(void)
{
ToolkitTestApplication application;
view.SetProperty( VideoView::Property::VIDEO, Property::Map()
.Add("rendererType", "IMAGE")
.Add("url", "video.mpg") // Note, videoView doesn't use this url
- .Add("RENDERER_TARGET", "windowSurfaceTarget" )
+ .Add("RENDERING_TARGET", "windowSurfaceTarget" )
.Add("width", 100)
.Add("height", 100) );
END_TEST;
}
-int UtcDaliVisualRemoveAndReset(void)
-{
- ToolkitTestApplication application;
- tet_infoline( "intUtcDaliVisualRemoveAndReset" );
-
- VisualFactory factory = VisualFactory::Get();
-
- DummyControl actor = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-
- actor.SetSize(200.f, 200.f);
- Stage::GetCurrent().Add( actor );
- DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
- Visual::Base imageVisual;
- // test calling RemoveAndReset with an empty handle
- try
- {
- imageVisual.RemoveAndReset( actor );
- tet_result(TET_PASS);
- }
- catch (DaliException& exception)
- {
- tet_result(TET_FAIL);
- }
-
- Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
- imageVisual = factory.CreateVisual(image);
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, imageVisual );
- DALI_TEST_CHECK( imageVisual );
- DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-
- imageVisual.RemoveAndReset( actor );
- application.SendNotification();
- application.Render(0);
- DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); // visual is removed from actor
- DALI_TEST_CHECK( !imageVisual ); // visual is reset
-
- END_TEST;
-}
int UtcDaliVisualGetPropertyMap1(void)
{
return GetImplementation( *this ).GetDepthIndex();
}
-void Visual::Base::RemoveAndReset( Actor& actor )
-{
- if( actor && *this )
- {
- GetImplementation(*this).SetOffStage( actor );
- }
- Reset();
-}
-
void Visual::Base::CreatePropertyMap( Property::Map& map ) const
{
GetImplementation( *this ).CreatePropertyMap( map );
*/
float GetDepthIndex() const;
- /**
- * @brief Remove the renderer from the actor and reset the visual self.
- *
- * This function can be called with an empty handle. If the visual is empty, this is a no-op.
- *
- * @param[in] actor The actor to be set off stage.
- */
- void RemoveAndReset( Actor& actor );
-
/**
* @brief Create the property map representing this visual.
*
mInputImage = inputImage;
Actor self( Self() );
- mVisuals[0].RemoveAndReset( self );
mVisuals[0] = Toolkit::VisualFactory::Get().CreateVisual( mInputImage );
- RegisterVisual( 0, mVisuals[0] );
+ RegisterVisual( 0, mVisuals[0] ); // Will clean up previously registered visuals for this index.
mVisuals[0].SetDepthIndex(0);
SetShaderEffect( mVisuals[0] );
mBlurredImage[i-1] = FrameBufferImage::New( mTargetSize.width/std::pow(2.f,exponent) , mTargetSize.height/std::pow(2.f,exponent),
GAUSSIAN_BLUR_RENDER_TARGET_PIXEL_FORMAT );
- mVisuals[i].RemoveAndReset( self );
- mVisuals[i] = Toolkit::VisualFactory::Get().CreateVisual( mBlurredImage[i - 1] );
- RegisterVisual( i, mVisuals[i] );
+ mVisuals[i] = Toolkit::VisualFactory::Get().CreateVisual( mBlurredImage[i - 1] );
+ RegisterVisual( i, mVisuals[i] ); // Will clean up existing visual with same index.
mVisuals[i].SetDepthIndex( i );
SetShaderEffect( mVisuals[i] );
}
int curPos = mVideoPlayer.GetPlayPosition();
mSetRenderingTarget = true;
- mVisual.RemoveAndReset( self );
+
+ if( mVisual )
+ {
+ Toolkit::GetImplementation(mVisual).SetOffStage(self);
+ mVisual.Reset();
+ }
mVideoPlayer.SetRenderingTarget( Dali::Adaptor::Get().GetNativeWindowHandle() );
mVideoPlayer.SetUrl( mUrl );
template< class ParameterType0, class ParameterType1 >
void InitializeVisual( Actor& actor, Toolkit::Visual::Base& visual, ParameterType0& param0, ParameterType1& param1 )
{
- visual.RemoveAndReset( actor );
+ if( actor )
+ {
+ Toolkit::GetImplementation(visual).SetOffStage( actor );
+ }
visual = Toolkit::VisualFactory::Get().CreateVisual( param0, param1 );
if( visual && actor && actor.OnStage() )
{
template< class ParameterType >
void InitializeVisual( Actor& actor, Toolkit::Visual::Base& visual, ParameterType& param )
{
- visual.RemoveAndReset( actor );
+ if( actor && visual )
+ {
+ Toolkit::GetImplementation(visual).SetOffStage( actor );
+ }
visual = Toolkit::VisualFactory::Get().CreateVisual( param );
if( visual && actor && actor.OnStage() )
{
void Control::ClearBackground()
{
- Actor self( Self() );
- mImpl->mBackgroundVisual.RemoveAndReset( self );
+ if( mImpl->mBackgroundVisual )
+ {
+ Actor self( Self() );
+ Toolkit::GetImplementation( mImpl->mBackgroundVisual ).SetOffStage( self );
+ mImpl->mBackgroundVisual.Reset();
+ }
mImpl->mBackgroundColor = Color::TRANSPARENT;
}
void Control::UnregisterVisual( Property::Index index )
{
- RegisteredVisualContainer::Iterator iter;
- if ( FindVisual( index, mImpl->mVisuals, iter ) )
- {
- mImpl->mVisuals.Erase( iter );
- }
+ RegisteredVisualContainer::Iterator iter;
+ if ( FindVisual( index, mImpl->mVisuals, iter ) )
+ {
+ mImpl->mVisuals.Erase( iter );
+ }
}
Toolkit::Visual::Base Control::GetVisual( Property::Index index ) const