OwnerPointer no longer does the Release hack behind the scene so if you want to transfer ownership
it needs to be OwnerPointer all the way
Change-Id: I3cbf6341142fd25ef3f2a0ebc875c2ef9797e8ad
#define __DALI_INTERNAL_MESSAGE_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.
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)( ParameterType< P >::PassObject( param1 ) );
+ (object->*memberFunction)( param1 );
}
private:
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- ParameterType< P1 >::PassObject( param1 ),
- ParameterType< P2 >::PassObject( param2 ) );
+ (object->*memberFunction)( param1, param2 );
}
private:
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- ParameterType< P1 >::PassObject( param1 ),
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ) );
+ (object->*memberFunction)( param1, param2, param3 );
}
private:
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- ParameterType< P1 >::PassObject( param1 ),
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ),
- ParameterType< P4 >::PassObject( param4 ) );
+ (object->*memberFunction)( param1, param2, param3, param4 );
}
private:
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- ParameterType< P1 >::PassObject( param1 ),
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ),
- ParameterType< P4 >::PassObject( param4 ),
- ParameterType< P5 >::PassObject( param5 ) );
+ (object->*memberFunction)( param1, param2, param3, param4, param5 );
}
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- ParameterType< P1 >::PassObject( param1 ),
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ),
- ParameterType< P4 >::PassObject( param4 ),
- ParameterType< P5 >::PassObject( param5 ),
- ParameterType< P6 >::PassObject( param6 ) );
+ (object->*memberFunction)( param1, param2, param3, param4, param5, param6 );
}
virtual void Process( BufferIndex bufferIndex )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- bufferIndex,
- ParameterType< P >::PassObject( param ) );
+ (object->*memberFunction)( bufferIndex, param );
}
private:
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
(object->*memberFunction)(
- bufferIndex,
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ) );
+ bufferIndex, param2, param3 );
}
private:
virtual void Process( BufferIndex bufferIndex )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- bufferIndex,
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ),
- ParameterType< P4 >::PassObject( param4 ) );
+ (object->*memberFunction)( bufferIndex, param2, param3, param4 );
}
private:
virtual void Process( BufferIndex bufferIndex )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- bufferIndex,
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ),
- ParameterType< P4 >::PassObject( param4 ),
- ParameterType< P5 >::PassObject( param5 ) );
+ (object->*memberFunction)( bufferIndex, param2, param3, param4, param5 );
}
private:
* Copy constructor. Passes the ownership of a pointer to another.
* @param[in] other The pointer that gives away the ownership.
*/
- OwnerPointer( OwnerPointer& other )
+ OwnerPointer( const OwnerPointer& other )
: mObject(NULL)
{
- Swap( other );
+ // other needs to be const for compiler to pick up this as copy constructor;
+ // though we are using this as move as there can only be one owner
+ Swap( const_cast<OwnerPointer&>( other ) );
}
/**
#define __DALI_INTERNAL_TYPE_ABSTRACTION_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.
{
typedef Type HolderType;
typedef Type PassingType;
- static PassingType PassObject( PassingType object ) { return object; }
};
// For complex types that are copied into the message,
{
typedef Type HolderType;
typedef const Type& PassingType;
- static PassingType PassObject( PassingType object ) { return object; }
};
// For complex types that are owned by the message,
-// They are passed as raw pointer and hold in an OwnerPointer
+// They are passed and hold in an OwnerPointer
template <typename Type>
struct OwnedType
{
typedef OwnerPointer<Type> HolderType;
- typedef Type* PassingType;
- static PassingType PassObject( HolderType& object ) { return object.Release(); }
+ typedef OwnerPointer<Type>& PassingType;
};
+
// Default for Vector3 and other structures
template <class T> struct ParameterType : public ComplexType< T > {};
void Actor::Initialize()
{
- // Node creation
- SceneGraph::Node* node = CreateNode();
-
- AddNodeMessage( GetEventThreadServices().GetUpdateManager(), *node ); // Pass ownership to scene-graph
- mNode = node; // Keep raw-pointer to Node
+ // Node creation, keep raw-pointer to Node for messaging
+ mNode = CreateNode();
+ OwnerPointer< SceneGraph::Node > transferOwnership( const_cast< SceneGraph::Node* >( mNode ) );
+ AddNodeMessage( GetEventThreadServices().GetUpdateManager(), transferOwnership );
OnInitialize();
// Vector of scene-graph nodes and their depths to send to UpdateManager
// in a single message
- SceneGraph::NodeDepths* sceneGraphNodeDepths = new SceneGraph::NodeDepths(actorCount);
+ OwnerPointer< SceneGraph::NodeDepths > sceneGraphNodeDepths = new SceneGraph::NodeDepths(actorCount);
// Traverse depth tree and set mSortedDepth on each actor and scenegraph node
uint32_t sortOrder = 1u; // Don't start at zero, as visual depth can be negative
actor->SetName("DefaultCamera");
- // Create scene-object and transfer ownership through message
- SceneGraph::Camera* sceneObject = SceneGraph::Camera::New();
- AddCameraMessage( actor->GetEventThreadServices().GetUpdateManager(), sceneObject );
-
- // Keep raw pointer for message passing
- actor->mSceneObject = sceneObject;
+ // Create scene-object and keep raw pointer for message passing
+ SceneGraph::Camera* camera = SceneGraph::Camera::New();
+ actor->mSceneObject = camera;
+ OwnerPointer< SceneGraph::Camera > transferOwnership( camera );
+ AddCameraMessage( actor->GetEventThreadServices().GetUpdateManager(), transferOwnership );
actor->SetPerspectiveProjection( size );
{
LayerPtr root( new Layer( Actor::ROOT_LAYER ) );
- // Second-phase construction
- SceneGraph::Layer* layer = static_cast<SceneGraph::Layer*>( root->CreateNode() );
- InstallRootMessage( manager, *layer, systemLevel ); // Transfer ownership to scene-graph
-
- // Keep a raw pointer to the layer node.
- root->mNode = layer;
+ // Second-phase construction, keep a raw pointer to the layer node.
+ SceneGraph::Layer* rootLayer = static_cast<SceneGraph::Layer*>( root->CreateNode() );
+ root->mNode = rootLayer;
+ OwnerPointer< SceneGraph::Layer > transferOwnership( rootLayer );
+ InstallRootMessage( manager, transferOwnership, systemLevel );
// root actor is immediately considered to be on-stage
root->mIsOnStage = true;
{
DALI_ASSERT_DEBUG( mAnimation == NULL );
- // Create a new animation, temporarily owned
- SceneGraph::Animation* animation = SceneGraph::Animation::New( mDurationSeconds, mSpeedFactor, mPlayRange, mLoopCount, mEndAction, mDisconnectAction );
-
- // Keep a const pointer to the animation.
- mAnimation = animation;
-
- // Transfer animation ownership to the update manager through a message
- AddAnimationMessage( mEventThreadServices.GetUpdateManager(), animation );
+ // Create a new animation, Keep a const pointer to the animation.
+ mAnimation = SceneGraph::Animation::New( mDurationSeconds, mSpeedFactor, mPlayRange, mLoopCount, mEndAction, mDisconnectAction );
+ OwnerPointer< SceneGraph::Animation > transferOwnership( const_cast< SceneGraph::Animation* >( mAnimation ) );
+ AddAnimationMessage( mEventThreadServices.GetUpdateManager(), transferOwnership );
}
void Animation::DestroySceneObject()
#define __DALI_INTERNAL_ACTIVE_CONSTRAINT_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.
if( targetProperty->IsTransformManagerProperty() ) //It is a property managed by the transform manager
{
// Connect the constraint
- SceneGraph::ConstraintBase* sceneGraphConstraint = SceneGraph::Constraint<PropertyType,TransformManagerPropertyAccessor<PropertyType> >::New( *targetProperty,
- propertyOwners,
- func );
- DALI_ASSERT_DEBUG( NULL != sceneGraphConstraint );
- sceneGraphConstraint->SetRemoveAction( mRemoveAction );
-
- // object is being used in a separate thread; queue a message to apply the constraint
- ApplyConstraintMessage( GetEventThreadServices(), *targetObject, *sceneGraphConstraint );
-
- // Keep a raw-pointer to the scene-graph constraint
- mSceneGraphConstraint = sceneGraphConstraint;
+ mSceneGraphConstraint = SceneGraph::Constraint<PropertyType,TransformManagerPropertyAccessor<PropertyType> >::New( *targetProperty,
+ propertyOwners,
+ func,
+ mRemoveAction );
}
else //SceneGraph property
{
// Connect the constraint
- SceneGraph::ConstraintBase* sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty,
- propertyOwners,
- func );
- DALI_ASSERT_DEBUG( NULL != sceneGraphConstraint );
- sceneGraphConstraint->SetRemoveAction( mRemoveAction );
-
- // object is being used in a separate thread; queue a message to apply the constraint
- ApplyConstraintMessage( GetEventThreadServices(), *targetObject, *sceneGraphConstraint );
-
- // Keep a raw-pointer to the scene-graph constraint
- mSceneGraphConstraint = sceneGraphConstraint;
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty,
+ propertyOwners,
+ func,
+ mRemoveAction );
}
+ OwnerPointer< SceneGraph::ConstraintBase > transferOwnership( const_cast< SceneGraph::ConstraintBase* >( mSceneGraphConstraint ) );
+ ApplyConstraintMessage( GetEventThreadServices(), *targetObject, transferOwnership );
}
}
const int componentIndex = mTargetObject->GetPropertyComponentIndex( mTargetIndex );
- SceneGraph::ConstraintBase* sceneGraphConstraint( NULL );
-
if ( Property::INVALID_COMPONENT_INDEX == componentIndex )
{
// Not a Vector2, Vector3 or Vector4 component, expecting float type
typedef SceneGraph::Constraint< float, PropertyAccessor<float> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty,
- propertyOwners,
- func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
else
{
if ( 0 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorX<Vector2> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
else if ( 1 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorY<Vector2> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
}
else if ( PropertyTypes::Get< Vector3 >() == targetProperty->GetType() )
if ( 0 == componentIndex )
{
typedef SceneGraph::Constraint< float, TransformManagerPropertyComponentAccessor<Vector3,0> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
else if ( 1 == componentIndex )
{
typedef SceneGraph::Constraint< float, TransformManagerPropertyComponentAccessor<Vector3,1> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
else if ( 2 == componentIndex )
{
typedef SceneGraph::Constraint< float, TransformManagerPropertyComponentAccessor<Vector3,2> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
}
else
if ( 0 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorX<Vector3> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
else if ( 1 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorY<Vector3> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
else if ( 2 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorZ<Vector3> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
}
}
if ( 0 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorX<Vector4> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
else if ( 1 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorY<Vector4> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
else if ( 2 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorZ<Vector4> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
else if ( 3 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorW<Vector4> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func );
+ mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
}
}
}
- DALI_ASSERT_DEBUG( NULL != sceneGraphConstraint );
- if( NULL != sceneGraphConstraint )
+ if( mSceneGraphConstraint )
{
- sceneGraphConstraint->SetRemoveAction( mRemoveAction );
-
- // object is being used in a separate thread; queue a message to apply the constraint
- ApplyConstraintMessage( GetEventThreadServices(), *targetObject, *sceneGraphConstraint );
-
- // Keep a raw-pointer to the scene-graph constraint
- mSceneGraphConstraint = sceneGraphConstraint;
+ OwnerPointer< SceneGraph::ConstraintBase > transferOwnership( const_cast< SceneGraph::ConstraintBase* >( mSceneGraphConstraint ) );
+ ApplyConstraintMessage( GetEventThreadServices(), *targetObject, transferOwnership );
}
}
}
}
// queue a message to add the property
- InstallCustomPropertyMessage( const_cast<EventThreadServices&>(GetEventThreadServices()), *scenePropertyOwner, newProperty.Release() ); // Message takes ownership
+ InstallCustomPropertyMessage( const_cast<EventThreadServices&>(GetEventThreadServices()), *scenePropertyOwner, newProperty ); // Message takes ownership
// notify the derived class (optional) method in case it needs to do some more work on the new property
// note! have to use the local pointer as OwnerPointer now points to NULL as it handed over its ownership
if( sceneObject != NULL )
{
- SceneGraph::UniformPropertyMapping* map = new SceneGraph::UniformPropertyMapping( uniformName, propertyPtr );
+ OwnerPointer< SceneGraph::UniformPropertyMapping > map = new SceneGraph::UniformPropertyMapping( uniformName, propertyPtr );
// Message takes ownership of Uniform map (and will delete it after copy)
- AddUniformMapMessage( const_cast<EventThreadServices&>(GetEventThreadServices()), *sceneObject, map);
+ AddUniformMapMessage( const_cast<EventThreadServices&>(GetEventThreadServices()), *sceneObject, map );
}
else
{
/*
- * 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.
// create a new DALi vector to store the buffer data
// the heap allocated vector will end up being owned by Render::PropertyBuffer
- Dali::Vector<char>* bufferCopy = new Dali::Vector<char>();
+ OwnerPointer< Vector<char> > bufferCopy = new Dali::Vector<char>();
bufferCopy->Resize( bufferSize );
// copy the data
void PropertyBuffer::Initialize( Dali::Property::Map& formatMap )
{
mRenderObject = new Render::PropertyBuffer();
- SceneGraph::AddPropertyBuffer(mEventThreadServices.GetUpdateManager(), *mRenderObject );
+ OwnerPointer< Render::PropertyBuffer > transferOwnership( mRenderObject );
+ SceneGraph::AddPropertyBuffer( mEventThreadServices.GetUpdateManager(), transferOwnership );
size_t numComponents = formatMap.Count();
// Create the format
- Render::PropertyBuffer::Format* format = new Render::PropertyBuffer::Format();
+ OwnerPointer< Render::PropertyBuffer::Format> format = new Render::PropertyBuffer::Format();
format->components.resize( numComponents );
unsigned int currentAlignment = 0u;
/*
- * 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.
// this method can be called from constructor and on stage connection
if( !mPropertyNotification )
{
- // Create a new PropertyNotification, temporarily owned
- SceneGraph::PropertyNotification* propertyNotification = SceneGraph::PropertyNotification::New( *mObject,
- mObjectPropertyIndex,
- mPropertyType,
- mComponentIndex,
- GetImplementation(mCondition).type,
- mRawConditionArgs,
- mNotifyMode );
- // Keep a const pointer to the PropertyNotification.
- mPropertyNotification = propertyNotification;
-
- // Transfer scene object ownership to the update manager through a message
- AddPropertyNotificationMessage( mUpdateManager, propertyNotification );
+ // Create a new PropertyNotification, keep a const pointer to it
+ mPropertyNotification = SceneGraph::PropertyNotification::New( *mObject,
+ mObjectPropertyIndex,
+ mPropertyType,
+ mComponentIndex,
+ GetImplementation( mCondition ).type,
+ mRawConditionArgs,
+ mNotifyMode );
+ OwnerPointer< SceneGraph::PropertyNotification > transferOwnership( const_cast<SceneGraph::PropertyNotification*>( mPropertyNotification ) );
+ AddPropertyNotificationMessage( mUpdateManager, transferOwnership );
}
}
CustomObject::CustomObject()
{
- PropertyOwner* updateObject = PropertyOwner::New();
+ mUpdateObject = PropertyOwner::New();
- // Pass ownership to the update-thread
- AddObjectMessage( GetEventThreadServices().GetUpdateManager(), updateObject );
-
- // Keep as const since this should only be modified from update-thread
- mUpdateObject = updateObject;
+ OwnerPointer< PropertyOwner > transferOwnership( mUpdateObject );
+ AddObjectMessage( GetEventThreadServices().GetUpdateManager(), transferOwnership );
}
} // namespace Internal
/*
- * 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.
if ( mSceneObject )
{
SceneGraph::RenderTask* sceneObject = taskImpl->CreateSceneObject();
- DALI_ASSERT_DEBUG( NULL != sceneObject );
- // Pass ownership to SceneGraph::RenderTaskList
- AddTaskMessage( mEventThreadServices, *mSceneObject, *sceneObject );
+ OwnerPointer< SceneGraph::RenderTask > transferOwnership( sceneObject );
+ AddTaskMessage( mEventThreadServices, *mSceneObject, transferOwnership );
}
// Set the default source & camera actors
std::size_t Geometry::AddVertexBuffer( PropertyBuffer& vertexBuffer )
{
mVertexBuffers.push_back( &vertexBuffer );
- SceneGraph::AddVertexBufferMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, *vertexBuffer.GetRenderObject() );
+ SceneGraph::AttachVertexBufferMessage( mEventThreadServices.GetUpdateManager(), *mRenderObject, *vertexBuffer.GetRenderObject() );
return mVertexBuffers.size() - 1u;
}
void Geometry::Initialize()
{
mRenderObject = new Render::Geometry();
- AddGeometry( mEventThreadServices.GetUpdateManager(), *mRenderObject );
+ OwnerPointer< Render::Geometry > transferOwnership( mRenderObject );
+ AddGeometry( mEventThreadServices.GetUpdateManager(), transferOwnership );
}
Geometry::~Geometry()
SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
mSceneObject = SceneGraph::Renderer::New();
- AddRendererMessage( updateManager, *mSceneObject );
+ OwnerPointer< SceneGraph::Renderer > transferOwnership( mSceneObject );
+ AddRendererMessage( updateManager, transferOwnership );
eventThreadServices.RegisterObject( this );
}
SceneGraph::UpdateManager& updateManager = mEventThreadServices.GetUpdateManager();
mRenderObject = new Render::Sampler();
- AddSamplerMessage( updateManager, *mRenderObject );
+ OwnerPointer< Render::Sampler > transferOwnership( mRenderObject );
+ AddSamplerMessage( updateManager, transferOwnership );
}
Sampler::~Sampler()
SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
mSceneObject = new SceneGraph::Shader( hints );
- // Add to update manager
- AddShaderMessage( updateManager, *mSceneObject );
+ OwnerPointer< SceneGraph::Shader > transferOwnership( mSceneObject );
+ AddShaderMessage( updateManager, transferOwnership );
// Try to load a precompiled shader binary for the source pair:
ThreadLocalStorage& tls = ThreadLocalStorage::Get();
/*
- * 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.
mRenderObject = new Render::Texture( mType, mFormat, mWidth, mHeight );
}
- AddTexture( mEventThreadServices.GetUpdateManager(), *mRenderObject );
+ OwnerPointer< Render::Texture > transferOwnership( mRenderObject );
+ AddTexture( mEventThreadServices.GetUpdateManager(), transferOwnership );
}
}
/*
- * 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.
SceneGraph::UpdateManager& updateManager = mEventThreadServices.GetUpdateManager();
mSceneObject = SceneGraph::TextureSet::New();
- AddTextureSetMessage( updateManager, *mSceneObject );
+ OwnerPointer< SceneGraph::TextureSet > transferOwnership( mSceneObject );
+ AddTextureSetMessage( updateManager, transferOwnership );
}
TextureSet::~TextureSet()
mImpl->defaultSurfaceRect = rect;
}
-void RenderManager::AddRenderer( Render::Renderer* renderer )
+void RenderManager::AddRenderer( OwnerPointer< Render::Renderer >& renderer )
{
// Initialize the renderer as we are now in render thread
renderer->Initialize( mImpl->context );
- mImpl->rendererContainer.PushBack( renderer );
+ mImpl->rendererContainer.PushBack( renderer.Release() );
if( !mImpl->renderersAdded )
{
mImpl->rendererContainer.EraseObject( renderer );
}
-void RenderManager::AddSampler( Render::Sampler* sampler )
+void RenderManager::AddSampler( OwnerPointer< Render::Sampler >& sampler )
{
- mImpl->samplerContainer.PushBack( sampler );
+ mImpl->samplerContainer.PushBack( sampler.Release() );
}
void RenderManager::RemoveSampler( Render::Sampler* sampler )
mImpl->samplerContainer.EraseObject( sampler );
}
-void RenderManager::AddTexture( Render::Texture* texture )
+void RenderManager::AddTexture( OwnerPointer< Render::Texture >& texture )
{
- mImpl->textureContainer.PushBack( texture );
- texture->Initialize(mImpl->context);
+ texture->Initialize( mImpl->context );
+ mImpl->textureContainer.PushBack( texture.Release() );
}
void RenderManager::RemoveTexture( Render::Texture* texture )
frameBuffer->AttachColorTexture( mImpl->context, texture, mipmapLevel, layer );
}
-void RenderManager::AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer )
+void RenderManager::AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertyBuffer )
{
- mImpl->propertyBufferContainer.PushBack( propertyBuffer );
+ mImpl->propertyBufferContainer.PushBack( propertyBuffer.Release() );
}
void RenderManager::RemovePropertyBuffer( Render::PropertyBuffer* propertyBuffer )
mImpl->propertyBufferContainer.EraseObject( propertyBuffer );
}
-void RenderManager::SetPropertyBufferFormat(Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format )
+void RenderManager::SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format )
{
- propertyBuffer->SetFormat( format );
+ propertyBuffer->SetFormat( format.Release() );
}
-void RenderManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size )
+void RenderManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size )
{
- propertyBuffer->SetData( data, size );
+ propertyBuffer->SetData( data.Release(), size );
}
void RenderManager::SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<unsigned short>& indices )
geometry->SetIndexBuffer( indices );
}
-void RenderManager::AddGeometry( Render::Geometry* geometry )
+void RenderManager::AddGeometry( OwnerPointer< Render::Geometry >& geometry )
{
- mImpl->geometryContainer.PushBack( geometry );
+ mImpl->geometryContainer.PushBack( geometry.Release() );
}
void RenderManager::RemoveGeometry( Render::Geometry* geometry )
mImpl->geometryContainer.EraseObject( geometry );
}
-void RenderManager::AddVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer )
+void RenderManager::AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer )
{
DALI_ASSERT_DEBUG( NULL != geometry );
* @param[in] renderer The renderer to add.
* @post renderer is owned by RenderManager
*/
- void AddRenderer( Render::Renderer* renderer );
+ void AddRenderer( OwnerPointer< Render::Renderer >& renderer );
/**
* Remove a Renderer from the render manager.
* @param[in] sampler The sampler to add.
* @post sampler is owned by RenderManager
*/
- void AddSampler( Render::Sampler* sampler );
+ void AddSampler( OwnerPointer< Render::Sampler >& sampler );
/**
* Remove a sampler from the render manager.
* @param[in] propertyBuffer The property buffer to add.
* @post propertBuffer is owned by RenderManager
*/
- void AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer );
+ void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertyBuffer );
/**
* Remove a property buffer from the render manager.
* @param[in] geometry The geometry to add.
* @post geometry is owned by RenderManager
*/
- void AddGeometry( Render::Geometry* geometry );
+ void AddGeometry( OwnerPointer< Render::Geometry >& geometry );
/**
* Remove a geometry from the render manager.
* @param[in] geometry The geometry
* @param[in] propertyBuffer The property buffer to remove.
*/
- void AddVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
+ void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
/**
* Remove a property buffer from a Render::Geometry from the render manager.
* @param[in] propertyBuffer The property buffer.
* @param[in] format The new format of the buffer
*/
- void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format );
+ void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format );
/**
* Sets the data of an existing property buffer
* @param[in] data The new data of the buffer
* @param[in] size The new size of the buffer
*/
- void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size );
+ void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size );
/**
* Sets the data for the index buffer of an existing geometry
* Adds a texture to the render manager
* @param[in] texture The texture to add
*/
- void AddTexture( Render::Texture* texture );
+ void AddTexture( OwnerPointer< Render::Texture >& texture );
/**
* Removes a texture from the render manager
/**
* Renders the results of the previous "update" traversal.
- * @param[out] status contains the flag that indicates if render instructions exist
+ * @param[out] status contains the rendering flags.
*/
void Render( Integration::RenderStatus& status );
{
}
-void Renderer::SetRenderDataProvider( SceneGraph::RenderDataProvider* dataProvider )
+void Renderer::SetRenderDataProvider( OwnerPointer<SceneGraph::RenderDataProvider>& dataProvider )
{
mRenderDataProvider = dataProvider;
mUpdateAttributesLocation = true;
- //Check that the number of textures match the number of samplers in the shader
- size_t textureCount = dataProvider->GetTextures().size();
- Program* program = dataProvider->GetShader().GetProgram();
+ // Check that the number of textures match the number of samplers in the shader
+ size_t textureCount = mRenderDataProvider->GetTextures().size();
+ Program* program = mRenderDataProvider->GetShader().GetProgram();
if( program && program->GetActiveSamplerCount() != textureCount )
{
DALI_LOG_WARNING("The number of active samplers in the shader(%lu) does not match the number of textures in the TextureSet(%lu)\n",
* Change the data providers of the renderer
* @param[in] dataProviders The data providers
*/
- void SetRenderDataProvider( SceneGraph::RenderDataProvider* dataProviders );
+ void SetRenderDataProvider( OwnerPointer<SceneGraph::RenderDataProvider>& dataProviders );
/**
* Change the geometry used by the renderer
mState = Destroyed;
}
-void Animation::AddAnimator( AnimatorBase* animator )
+void Animation::AddAnimator( OwnerPointer<AnimatorBase>& animator )
{
animator->ConnectToSceneGraph();
animator->SetDisconnectAction( mDisconnectAction );
- mAnimators.PushBack( animator );
+ mAnimators.PushBack( animator.Release() );
}
void Animation::Update(BufferIndex bufferIndex, float elapsedSeconds, bool& looped, bool& finished )
#define __DALI_INTERNAL_SCENE_GRAPH_ANIMATION_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.
* @param[in] propertyOwner The scene-object that owns the animatable property.
* @post The animator is owned by this animation.
*/
- void AddAnimator( AnimatorBase* animator );
+ void AddAnimator( OwnerPointer<AnimatorBase>& animator );
/**
* Retrieve the animators from an animation.
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &animation, &Animation::AddAnimator, &animator );
+ OwnerPointer<AnimatorBase> parameter( &animator );
+ new (slot) LocalType( &animation, &Animation::AddAnimator, parameter );
}
/*
- * 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.
unsigned int ConstraintBase::mTotalInstanceCount = 0;
#endif
-ConstraintBase::ConstraintBase( PropertyOwnerContainer& ownerSet )
-: mRemoveAction( Dali::Constraint::DEFAULT_REMOVE_ACTION ),
+ConstraintBase::ConstraintBase( PropertyOwnerContainer& ownerSet, RemoveAction removeAction )
+: mRemoveAction( removeAction ),
mFirstApply( true ),
mDisconnected( true ),
mObservedOwners( ownerSet )
#define __DALI_INTERNAL_SCENE_GRAPH_CONSTRAINT_BASE_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.
/**
* Constructor
+ * @param ownerContainer the properties to constraint
+ * @oparam removeAction perform when removed
*/
- ConstraintBase( PropertyOwnerContainer& ownerContainer );
+ ConstraintBase( PropertyOwnerContainer& ownerContainer, RemoveAction removeAction );
/**
* Virtual destructor.
#define __DALI_INTERNAL_SCENE_GRAPH_CONSTRAINT_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.
* @param[in] targetProperty The target property.
* @param[in] ownerSet A set of property owners; func is connected to the properties provided by these objects.
* @param[in] func The function to calculate the final constrained value.
+ * @param[in] removeAction Remove action to perform when constraint is removed
* @return A smart-pointer to a newly allocated constraint.
*/
static ConstraintBase* New( const PropertyBase& targetProperty,
PropertyOwnerContainer& ownerContainer,
- ConstraintFunctionPtr func )
+ ConstraintFunctionPtr func,
+ RemoveAction removeAction )
{
// Scene-graph thread can edit these objects
PropertyBase& property = const_cast< PropertyBase& >( targetProperty );
return new Constraint< PropertyType, PropertyAccessorType >( property,
ownerContainer,
- func );
+ func,
+ removeAction );
}
/**
*/
Constraint( PropertyBase& targetProperty,
PropertyOwnerContainer& ownerContainer,
- ConstraintFunctionPtr func )
- : ConstraintBase( ownerContainer ),
+ ConstraintFunctionPtr func,
+ RemoveAction removeAction )
+ : ConstraintBase( ownerContainer, removeAction ),
mTargetProperty( &targetProperty ),
mFunc( func )
{
#define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_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.
// Messages for PropertyOwner
-inline void InstallCustomPropertyMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, PropertyBase* property )
+inline void InstallCustomPropertyMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, OwnerPointer<PropertyBase>& property )
{
typedef MessageValue1< PropertyOwner, OwnerPointer<PropertyBase> > LocalType;
new (slot) LocalType( &owner, &PropertyOwner::InstallCustomProperty, property );
}
-inline void ApplyConstraintMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, ConstraintBase& constraint )
+inline void ApplyConstraintMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, OwnerPointer<ConstraintBase>& constraint )
{
typedef MessageValue1< PropertyOwner, OwnerPointer<ConstraintBase> > LocalType;
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &owner, &PropertyOwner::ApplyConstraint, &constraint );
+ new (slot) LocalType( &owner, &PropertyOwner::ApplyConstraint, constraint );
}
inline void RemoveConstraintMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, const ConstraintBase& constConstraint )
new (slot) LocalType( &owner, &PropertyOwner::RemoveConstraint, &constraint );
}
-inline void AddUniformMapMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, UniformPropertyMapping* map )
+inline void AddUniformMapMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, OwnerPointer< UniformPropertyMapping >& map )
{
typedef MessageValue1< PropertyOwner, OwnerPointer< UniformPropertyMapping > > LocalType;
+
+ // Reserve some memory inside the message queue
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
new (slot) LocalType( &owner, &PropertyOwner::AddUniformMapping, map );
}
inline void RemoveUniformMapMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, const std::string& uniformName )
{
typedef MessageValue1< PropertyOwner, std::string > LocalType;
+
+ // Reserve some memory inside the message queue
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
new (slot) LocalType( &owner, &PropertyOwner::RemoveUniformMapping, uniformName );
}
/*
- * 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.
mConstraints.Clear();
}
-void PropertyOwner::InstallCustomProperty(PropertyBase* property)
+void PropertyOwner::InstallCustomProperty( OwnerPointer<PropertyBase>& property )
{
- DALI_ASSERT_DEBUG( NULL != property );
-
- mCustomProperties.PushBack( property );
+ mCustomProperties.PushBack( property.Release() );
}
void PropertyOwner::ResetToBaseValues( BufferIndex updateBufferIndex )
return mConstraints;
}
-void PropertyOwner::ApplyConstraint( ConstraintBase* constraint )
+void PropertyOwner::ApplyConstraint( OwnerPointer<ConstraintBase>& constraint )
{
- mConstraints.PushBack( constraint );
-
constraint->OnConnect();
+ mConstraints.PushBack( constraint.Release() );
}
void PropertyOwner::RemoveConstraint( ConstraintBase* constraint )
{
}
-void PropertyOwner::AddUniformMapping( UniformPropertyMapping* map )
+void PropertyOwner::AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map )
{
- mUniformMaps.Add( map );
+ mUniformMaps.Add( map.Release() );
}
void PropertyOwner::RemoveUniformMapping( const std::string& uniformName )
#define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_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.
* @post The PropertyOwner takes ownership of the property.
* @param[in] property A pointer to a newly allocated property.
*/
- void InstallCustomProperty(PropertyBase* property);
+ void InstallCustomProperty( OwnerPointer<PropertyBase>& property );
/**
* Retrieve the custom properties owned by the object.
* Apply a constraint.
* @param[in] constraint The constraint to apply.
*/
- void ApplyConstraint( ConstraintBase* constraint );
+ void ApplyConstraint( OwnerPointer<ConstraintBase>& constraint );
/**
* Begin removal of constraints.
/**
* @copydoc UniformMap::Add
*/
- virtual void AddUniformMapping( UniformPropertyMapping* map );
+ virtual void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map );
/**
* @copydoc UniformMap::Remove
/*
- * 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.
{
}
-void RenderMessageDispatcher::AddRenderer( Render::Renderer& renderer )
+void RenderMessageDispatcher::AddRenderer( OwnerPointer< Render::Renderer >& renderer )
{
// Message has ownership of renderer while in transit from update -> render
typedef MessageValue1< RenderManager, OwnerPointer< Render::Renderer > > DerivedType;
unsigned int* slot = mRenderQueue.ReserveMessageSlot( mBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mRenderManager, &RenderManager::AddRenderer, &renderer );
+ new (slot) DerivedType( &mRenderManager, &RenderManager::AddRenderer, renderer );
}
void RenderMessageDispatcher::RemoveRenderer( Render::Renderer& renderer )
#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_MESSAGE_DISPATCHER_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.
// INTERNAL INCLUDES
#include <dali/internal/update/common/scene-graph-buffers.h>
#include <dali/internal/render/gl-resources/gpu-buffer.h>
+#include <dali/internal/render/renderers/render-renderer.h>
#include <dali/internal/render/renderers/render-property-buffer.h>
namespace Dali
namespace Render
{
-class Renderer;
class RenderTracker;
}
namespace SceneGraph
* @param[in] renderer The renderer to add.
* @post renderer ownership is transferred.
*/
- void AddRenderer( Render::Renderer& renderer );
+ void AddRenderer( OwnerPointer< Render::Renderer >& renderer );
/**
* Remove a Renderer.
(*iter)->SetSourceNode( NULL );
}
- // UpdateManager owns the Nodes
+ // UpdateManager owns the Nodes. Although Nodes are pool allocated they contain heap allocated parts
+ // like custom properties, which get released here
Vector<Node*>::Iterator iter = nodes.Begin()+1;
Vector<Node*>::Iterator endIter = nodes.End();
for(;iter!=endIter;++iter)
delete mImpl;
}
-void UpdateManager::InstallRoot( SceneGraph::Layer* layer, bool systemLevel )
+void UpdateManager::InstallRoot( OwnerPointer<Layer>& layer, bool systemLevel )
{
DALI_ASSERT_DEBUG( layer->IsLayer() );
DALI_ASSERT_DEBUG( layer->GetParent() == NULL);
if ( !systemLevel )
{
DALI_ASSERT_DEBUG( mImpl->root == NULL && "Root Node already installed" );
- mImpl->root = layer;
+ mImpl->root = layer.Release();
mImpl->root->CreateTransform( &mImpl->transformManager );
+ mImpl->root->SetRoot(true);
}
else
{
DALI_ASSERT_DEBUG( mImpl->systemLevelRoot == NULL && "System-level Root Node already installed" );
- mImpl->systemLevelRoot = layer;
+ mImpl->systemLevelRoot = layer.Release();
mImpl->systemLevelRoot->CreateTransform( &mImpl->transformManager );
+ mImpl->systemLevelRoot->SetRoot(true);
}
- layer->SetRoot(true);
}
-void UpdateManager::AddNode( Node* node )
+void UpdateManager::AddNode( OwnerPointer<Node>& node )
{
- DALI_ASSERT_ALWAYS( NULL != node );
DALI_ASSERT_ALWAYS( NULL == node->GetParent() ); // Should not have a parent yet
// Nodes must be sorted by pointer
+ Node* rawNode = node.Release();
Vector<Node*>::Iterator begin = mImpl->nodes.Begin();
- for(Vector<Node*>::Iterator iter = mImpl->nodes.End()-1; iter >= begin; --iter)
+ for( Vector<Node*>::Iterator iter = mImpl->nodes.End()-1; iter >= begin; --iter )
{
- if(node > (*iter))
+ if( rawNode > (*iter) )
{
- mImpl->nodes.Insert((iter+1), node);
- node->CreateTransform( &mImpl->transformManager );
- break;
+ mImpl->nodes.Insert((iter+1), rawNode );
+ rawNode->CreateTransform( &mImpl->transformManager );
+ return;
}
}
}
node->OnDestroy();
}
-void UpdateManager::AddCamera( Camera* camera )
+void UpdateManager::AddCamera( OwnerPointer< Camera >& camera )
{
- DALI_ASSERT_DEBUG( camera != NULL );
-
- mImpl->cameras.PushBack( camera ); // takes ownership
+ mImpl->cameras.PushBack( camera.Release() ); // takes ownership
}
void UpdateManager::RemoveCamera( const Camera* camera )
EraseUsingDiscardQueue( mImpl->cameras, const_cast<Camera*>( camera ), mImpl->discardQueue, mSceneGraphBuffers.GetUpdateBufferIndex() );
}
-void UpdateManager::AddObject( PropertyOwner* object )
+void UpdateManager::AddObject( OwnerPointer<PropertyOwner>& object )
{
- DALI_ASSERT_DEBUG( NULL != object );
-
- mImpl->customObjects.PushBack( object );
+ mImpl->customObjects.PushBack( object.Release() );
}
void UpdateManager::RemoveObject( PropertyOwner* object )
mImpl->customObjects.EraseObject( object );
}
-void UpdateManager::AddAnimation( Animation* animation )
+void UpdateManager::AddAnimation( OwnerPointer< SceneGraph::Animation >& animation )
{
- mImpl->animations.PushBack( animation );
+ mImpl->animations.PushBack( animation.Release() );
}
void UpdateManager::StopAnimation( Animation* animation )
return isRunning;
}
-void UpdateManager::AddPropertyNotification( PropertyNotification* propertyNotification )
+void UpdateManager::AddPropertyNotification( OwnerPointer< PropertyNotification >& propertyNotification )
{
- mImpl->propertyNotifications.PushBack( propertyNotification );
+ mImpl->propertyNotifications.PushBack( propertyNotification.Release() );
}
void UpdateManager::RemovePropertyNotification( PropertyNotification* propertyNotification )
propertyNotification->SetNotifyMode( notifyMode );
}
-void UpdateManager::AddShader( Shader* shader )
+void UpdateManager::AddShader( OwnerPointer< Shader >& shader )
{
- DALI_ASSERT_DEBUG( NULL != shader );
-
- mImpl->shaders.PushBack( shader );
+ mImpl->shaders.PushBack( shader.Release() );
}
void UpdateManager::RemoveShader( Shader* shader )
mImpl->shaderSaver = &upstream;
}
-void UpdateManager::AddRenderer( Renderer* renderer )
+void UpdateManager::AddRenderer( OwnerPointer< Renderer >& renderer )
{
- DALI_ASSERT_DEBUG( renderer != NULL );
-
- mImpl->renderers.PushBack( renderer );
-
renderer->ConnectToSceneGraph( *mImpl->sceneController, mSceneGraphBuffers.GetUpdateBufferIndex() );
+ mImpl->renderers.PushBack( renderer.Release() );
}
void UpdateManager::RemoveRenderer( Renderer* renderer )
mImpl->panGestureProcessor = panGestureProcessor;
}
-void UpdateManager::AddTextureSet( TextureSet* textureSet )
+void UpdateManager::AddTextureSet( OwnerPointer< TextureSet >& textureSet )
{
- DALI_ASSERT_DEBUG( NULL != textureSet );
-
- mImpl->textureSets.PushBack( textureSet );
+ mImpl->textureSets.PushBack( textureSet.Release() );
}
void UpdateManager::RemoveTextureSet( TextureSet* textureSet )
}
}
-void UpdateManager::SetDepthIndices( NodeDepths* nodeDepths )
+void UpdateManager::SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths )
{
- if( nodeDepths )
+ // note,this vector is already in depth order. It could be used as-is to
+ // remove sorting in update algorithm. However, it lacks layer boundary markers.
+ for( std::vector<NodeDepthPair>::iterator iter = nodeDepths->nodeDepths.begin(),
+ end = nodeDepths->nodeDepths.end() ;
+ iter != end ; ++iter )
{
- // note,this vector is already in depth order. It could be used as-is to
- // remove sorting in update algorithm. However, it lacks layer boundary markers.
- for( std::vector<NodeDepthPair>::iterator iter = nodeDepths->nodeDepths.begin(),
- end = nodeDepths->nodeDepths.end() ;
- iter != end ; ++iter )
- {
- iter->node->SetDepthIndex( iter->sortedDepth );
- }
+ iter->node->SetDepthIndex( iter->sortedDepth );
}
}
-void UpdateManager::AddSampler( Render::Sampler* sampler )
+void UpdateManager::AddSampler( OwnerPointer< Render::Sampler >& sampler )
{
// Message has ownership of Sampler while in transit from update to render
typedef MessageValue1< RenderManager, OwnerPointer< Render::Sampler > > DerivedType;
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetWrapMode, sampler, rWrapMode, sWrapMode, tWrapMode );
}
-void UpdateManager::AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer )
+void UpdateManager::AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertyBuffer )
{
// Message has ownership of format while in transit from update -> render
typedef MessageValue1< RenderManager, OwnerPointer< Render::PropertyBuffer > > DerivedType;
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemovePropertyBuffer, propertyBuffer );
}
-void UpdateManager::SetPropertyBufferFormat(Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format )
+void UpdateManager::SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format )
{
// Message has ownership of format while in transit from update -> render
typedef MessageValue2< RenderManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format > > DerivedType;
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetPropertyBufferFormat, propertyBuffer, format );
}
-void UpdateManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size )
+void UpdateManager::SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size )
{
// Message has ownership of format while in transit from update -> render
typedef MessageValue3< RenderManager, Render::PropertyBuffer*, OwnerPointer< Dali::Vector<char> >, size_t > DerivedType;
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetPropertyBufferData, propertyBuffer, data, size );
}
-void UpdateManager::AddGeometry( Render::Geometry* geometry )
+void UpdateManager::AddGeometry( OwnerPointer< Render::Geometry >& geometry )
{
// Message has ownership of format while in transit from update -> render
typedef MessageValue1< RenderManager, OwnerPointer< Render::Geometry > > DerivedType;
new (slot) DerivedType( &mImpl->renderManager, &RenderManager::RemoveVertexBuffer, geometry, propertyBuffer );
}
-void UpdateManager::AddVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer )
+void UpdateManager::AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer )
{
typedef MessageValue2< RenderManager, Render::Geometry*, Render::PropertyBuffer* > DerivedType;
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddVertexBuffer, geometry, propertyBuffer );
+ new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AttachVertexBuffer, geometry, propertyBuffer );
}
-void UpdateManager::AddTexture( Render::Texture* texture )
+void UpdateManager::AddTexture( OwnerPointer< Render::Texture >& texture )
{
// Message has ownership of Texture while in transit from update -> render
typedef MessageValue1< RenderManager, OwnerPointer< Render::Texture > > DerivedType;
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddTexture, texture );
+ new (slot) DerivedType( &mImpl->renderManager, &RenderManager::AddTexture, texture );
}
void UpdateManager::RemoveTexture( Render::Texture* texture)
struct NodeDepths
{
- std::vector<NodeDepthPair> nodeDepths;
NodeDepths( int reserveSize )
{
nodeDepths.reserve(reserveSize);
{
nodeDepths.push_back( NodeDepthPair( node, sortedDepth ) );
}
+
+ std::vector<NodeDepthPair> nodeDepths;
};
* @param[in] systemLevel True if using the system-level overlay.
* @post The node is owned by UpdateManager.
*/
- void InstallRoot( Layer* layer, bool systemLevel );
+ void InstallRoot( OwnerPointer<Layer>& layer, bool systemLevel );
/**
* Add a Node; UpdateManager takes ownership.
* @pre The node does not have a parent.
+ * @note even though nodes are pool allocated, they also contain other heap allocated data, thus using OwnerPointer when transferring the data
* @param[in] node The node to add.
*/
- void AddNode( Node* node );
+ void AddNode( OwnerPointer<Node>& node );
/**
* Connect a Node to the scene-graph.
* Add a camera on scene
* @param[in] camera to add
*/
- void AddCamera( Camera* camera );
+ void AddCamera( OwnerPointer< Camera >& camera );
/**
* Remove a camera from scene
* @param[in] object The object to add.
* @post The object is owned by UpdateManager.
*/
- void AddObject( PropertyOwner* object );
+ void AddObject( OwnerPointer<PropertyOwner>& object );
/**
* Remove an object.
* @param[in] animation The animation to add.
* @post The animation is owned by UpdateManager.
*/
- void AddAnimation( Animation* animation );
+ void AddAnimation( OwnerPointer< SceneGraph::Animation >& animation );
/**
* Stop an animation.
* @param[in] propertyNotification The notification to add
* @post The propertyNotification is owned by UpdateManager.
*/
- void AddPropertyNotification( PropertyNotification* propertyNotification );
+ void AddPropertyNotification( OwnerPointer< PropertyNotification >& propertyNotification );
/**
* Remove a property notification
* @param[in] shader The shader to add.
* @post The shader is owned by the UpdateManager.
*/
- void AddShader(Shader* shader);
+ void AddShader( OwnerPointer< Shader >& shader );
/**
* Remove a shader.
* @param[in] shader The shader to remove.
* @post The shader is destroyed.
*/
- void RemoveShader(Shader* shader);
+ void RemoveShader( Shader* shader );
/**
* Set the shader program for a Shader object
* Add a new renderer to scene
* @param renderer to add
*/
- void AddRenderer( Renderer* renderer );
+ void AddRenderer( OwnerPointer< Renderer >& renderer );
/**
* Add a renderer from scene
* @param[in] textureSet The texture set to add.
* @post The TextureSet is owned by the UpdateManager.
*/
- void AddTextureSet( TextureSet* textureSet );
+ void AddTextureSet( OwnerPointer< TextureSet >& textureSet );
/**
* Remove a TextureSet.
* @post Sends a message to RenderManager to add the sampler.
* The sampler will be owned by RenderManager
*/
- void AddSampler( Render::Sampler* sampler );
+ void AddSampler( OwnerPointer< Render::Sampler >& sampler );
/**
* Removes an existing sampler from RenderManager
* @post Sends a message to RenderManager to add the property buffer.
* The property buffer will be owned by RenderManager
*/
- void AddPropertyBuffer( Render::PropertyBuffer* propertryBuffer );
+ void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertryBuffer );
/**
* Removes an existing PropertyBuffer from RenderManager
* @param[in] format The new format of the buffer
* @post Sends a message to RenderManager to set the new format to the property buffer.
*/
- void SetPropertyBufferFormat(Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format );
+ void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format );
/**
* Sets the data of an existing property buffer
* @param[in] size The new size of the buffer
* @post Sends a message to RenderManager to set the new data to the property buffer.
*/
- void SetPropertyBufferData(Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size);
+ void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size );
/**
* Adds a geometry to the RenderManager
* @post Sends a message to RenderManager to add the Geometry
* The geometry will be owned by RenderManager
*/
- void AddGeometry( Render::Geometry* geometry );
+ void AddGeometry( OwnerPointer< Render::Geometry >& geometry );
/**
* Removes an existing Geometry from RenderManager
void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<unsigned short>& indices );
/**
- * Adds a vertex buffer to a geomtry
+ * Adds a vertex buffer to a geometry
* @param[in] geometry The geometry
* @param[in] propertyBuffer The property buffer
*/
- void AddVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
+ void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
/**
* Removes a vertex buffer from a geometry
* @param[in] texture The texture to add
* The texture will be owned by RenderManager
*/
- void AddTexture( Render::Texture* texture );
+ void AddTexture( OwnerPointer< Render::Texture >& texture );
/**
* Removes a texture from the render manager
* Set the depth indices of all nodes (in LayerUI's)
* @param[in] nodeDepths A vector of nodes and associated depth indices
*/
- void SetDepthIndices( NodeDepths* nodeDepths );
+ void SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths );
private:
// Messages for UpdateManager
-inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
+inline void InstallRootMessage( UpdateManager& manager, OwnerPointer<Layer>& root, bool systemLevel )
{
// Message has ownership of Layer while in transit from event -> update
typedef MessageValue2< UpdateManager, OwnerPointer<Layer>, bool > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
+ new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root, systemLevel );
}
-inline void AddNodeMessage( UpdateManager& manager, Node& node )
+inline void AddNodeMessage( UpdateManager& manager, OwnerPointer<Node>& node )
{
// Message has ownership of Node while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
+ new (slot) LocalType( &manager, &UpdateManager::AddNode, node );
}
inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
}
-inline void AddCameraMessage( UpdateManager& manager, const Camera* constCamera )
+inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& camera )
{
// Message has ownership of Camera while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< Camera > > LocalType;
- Camera* camera = const_cast<Camera*>( constCamera );
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, camera );
}
-inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
+inline void AddObjectMessage( UpdateManager& manager, OwnerPointer<PropertyOwner>& object )
{
// Message has ownership of object while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
}
-inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
+inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Animation >& animation )
{
- typedef MessageValue1< UpdateManager, Animation* > LocalType;
+ typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::Animation > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
}
-inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
+inline void AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer< PropertyNotification >& propertyNotification )
{
// Message has ownership of PropertyNotification while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< PropertyNotification > > LocalType;
}
// The render thread can safely change the Shader
-inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
+inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& shader )
{
typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
+ new (slot) LocalType( &manager, &UpdateManager::AddShader, shader );
}
// The render thread can safely change the Shader
new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
}
-inline void AddRendererMessage( UpdateManager& manager, Renderer& object )
+inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer >& object )
{
typedef MessageValue1< UpdateManager, OwnerPointer< Renderer > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddRenderer, &object );
+ new (slot) LocalType( &manager, &UpdateManager::AddRenderer, object );
}
inline void RemoveRendererMessage( UpdateManager& manager, Renderer& object )
}
// The render thread can safely change the Shader
-inline void AddTextureSetMessage( UpdateManager& manager, TextureSet& textureSet )
+inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureSet >& textureSet )
{
typedef MessageValue1< UpdateManager, OwnerPointer< TextureSet > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddTextureSet, &textureSet );
+ new (slot) LocalType( &manager, &UpdateManager::AddTextureSet, textureSet );
}
// The render thread can safely change the Shader
new (slot) LocalType( &manager, &UpdateManager::RemoveTextureSet, &textureSet );
}
-inline void AddSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
+inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sampler >& sampler )
{
// Message has ownership of Sampler while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< Render::Sampler > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddSampler, &sampler );
+ new (slot) LocalType( &manager, &UpdateManager::AddSampler, sampler );
}
inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
new (slot) LocalType( &manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode );
}
-inline void AddPropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer )
+inline void AddPropertyBuffer( UpdateManager& manager, OwnerPointer< Render::PropertyBuffer >& propertyBuffer )
{
// Message has ownership of propertyBuffer while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< Render::PropertyBuffer > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddPropertyBuffer, &propertyBuffer );
+ new (slot) LocalType( &manager, &UpdateManager::AddPropertyBuffer, propertyBuffer );
}
inline void RemovePropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer )
new (slot) LocalType( &manager, &UpdateManager::RemovePropertyBuffer, &propertyBuffer );
}
-inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, Render::PropertyBuffer::Format* format )
+inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format )
{
// Message has ownership of PropertyBuffer::Format while in transit from event -> update
typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format> > LocalType;
new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferFormat, &propertyBuffer, format );
}
-inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, Vector<char>* data, size_t size )
+inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size )
{
// Message has ownership of PropertyBuffer data while in transit from event -> update
typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector<char> >, size_t > LocalType;
new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferData, &propertyBuffer, data, size );
}
-inline void AddGeometry( UpdateManager& manager, Render::Geometry& geometry )
+inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry >& geometry )
{
// Message has ownership of Geometry while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< Render::Geometry > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddGeometry, &geometry );
+ new (slot) LocalType( &manager, &UpdateManager::AddGeometry, geometry );
}
inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry )
new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry );
}
-inline void AddVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
+inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
{
typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
+ new (slot) LocalType( &manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
}
inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
new (slot) LocalType( &manager, &UpdateManager::SetGeometryType, &geometry, geometryType );
}
-inline void AddTexture( UpdateManager& manager, Render::Texture& texture )
+inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& texture )
{
// Message has ownership of Texture while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< Render::Texture > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddTexture, &texture );
+ new (slot) LocalType( &manager, &UpdateManager::AddTexture, texture );
}
inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture )
new (slot) LocalType( &manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer );
}
-inline void SetDepthIndicesMessage( UpdateManager& manager, NodeDepths* nodeDepths )
+inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDepths >& nodeDepths )
{
typedef MessageValue1< UpdateManager, OwnerPointer< NodeDepths > > LocalType;
new (slot) LocalType( &manager, &UpdateManager::SetDepthIndices, nodeDepths );
}
-
} // namespace SceneGraph
} // namespace Internal
mIsRoot = isRoot;
}
-void Node::AddUniformMapping( UniformPropertyMapping* map )
+void Node::AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map )
{
PropertyOwner::AddUniformMapping( map );
mRegenerateUniformMap = 2;
/**
* @copydoc UniformMap::Add
*/
- void AddUniformMapping( UniformPropertyMapping* map );
+ void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map );
/**
* @copydoc UniformMap::Remove
/*
- * 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.
{
}
-void RenderTaskList::AddTask( RenderTask* newTask )
+void RenderTaskList::AddTask( OwnerPointer< RenderTask >& newTask )
{
DALI_ASSERT_DEBUG( newTask != NULL && "SceneGraph RenderTask is null");
- // mRenderTasks container takes ownership
- mRenderTasks.PushBack( newTask );
newTask->Initialize( mRenderMessageDispatcher );
+ // mRenderTasks container takes ownership
+ mRenderTasks.PushBack( newTask.Release() );
}
void RenderTaskList::RemoveTask( RenderTask* task )
#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_LIST_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.
* Add a new RenderTask to the list.
* @param[in] newTask The RenderTaskList takes ownership of this task.
*/
- void AddTask( RenderTask* newTask );
+ void AddTask( OwnerPointer< RenderTask >& newTask );
/**
* Remove a RenderTask from the list.
// Messages for RenderTaskList
-inline void AddTaskMessage( EventThreadServices& eventThreadServices, RenderTaskList& list, RenderTask& task )
+inline void AddTaskMessage( EventThreadServices& eventThreadServices, RenderTaskList& list, OwnerPointer< RenderTask >& task )
{
// Message has ownership of the RenderTask while in transit from event -> update
typedef MessageValue1< RenderTaskList, OwnerPointer< RenderTask > > LocalType;
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &list, &RenderTaskList::AddTask, &task );
+ new (slot) LocalType( &list, &RenderTaskList::AddTask, task );
}
inline void RemoveTaskMessage( EventThreadServices& eventThreadServices, RenderTaskList& list, const RenderTask& constTask )
{
if( mResendFlag & RESEND_DATA_PROVIDER )
{
- RenderDataProvider* dataProvider = NewRenderDataProvider();
+ OwnerPointer<RenderDataProvider> dataProvider = NewRenderDataProvider();
typedef MessageValue1< Render::Renderer, OwnerPointer<RenderDataProvider> > DerivedType;
unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
mRenderer = Render::Renderer::New( dataProvider, mGeometry, mBlendBitmask, GetBlendColor(), static_cast< FaceCullingMode::Type >( mFaceCullingMode ),
mPremultipledAlphaEnabled, mDepthWriteMode, mDepthTestMode, mDepthFunction, mStencilParameters );
- mSceneController->GetRenderMessageDispatcher().AddRenderer( *mRenderer );
+ OwnerPointer< Render::Renderer > transferOwnership( mRenderer );
+ mSceneController->GetRenderMessageDispatcher().AddRenderer( transferOwnership );
}
//Called just before destroying the scene-graph renderer ( when the "event-thread renderer" is no longer referenced )