#define DALI_INTERNAL_SCENE_GRAPH_LAYER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
Renderer* mRenderer;
};
-typedef Dali::Vector< Renderable > RenderableContainer;
+using RenderableContainer = Dali::Vector<Renderable>;
/**
* Layers have a "depth" relative to all other layers in the scene-graph.
class Layer : public Node
{
public:
-
- typedef Dali::Layer::SortFunctionType SortFunctionType;
+ using SortFunctionType = Dali::Layer::SortFunctionType;
// Creation methods
static SceneGraph::Layer* New();
/**
+ * Virtual destructor
+ */
+ ~Layer() override;
+
+ /**
* From Node, to convert a node to a layer.
* @return The layer.
*/
- virtual Layer* GetLayer()
+ Layer* GetLayer() override
{
return this;
}
// Undefined
Layer(const Layer&);
- /**
- * Virtual destructor
- */
- virtual ~Layer();
-
// Undefined
Layer& operator=(const Layer& rhs);
*/
inline void SetSortFunctionMessage( EventThreadServices& eventThreadServices, const Layer& layer, Dali::Layer::SortFunctionType function )
{
- typedef MessageValue1< Layer, Dali::Layer::SortFunctionType > LocalType;
+ using LocalType = MessageValue1<Layer, Dali::Layer::SortFunctionType>;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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( &layer, &Layer::SetSortFunction, function );
*/
inline void SetClippingMessage( EventThreadServices& eventThreadServices, const Layer& layer, bool enabled )
{
- typedef MessageValue1< Layer, bool > LocalType;
+ using LocalType = MessageValue1<Layer, bool>;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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( &layer, &Layer::SetClipping, enabled );
*/
inline void SetClippingBoxMessage( EventThreadServices& eventThreadServices, const Layer& layer, const Dali::ClippingBox& clippingbox )
{
- typedef MessageValue1< Layer, Dali::ClippingBox > LocalType;
+ using LocalType = MessageValue1<Layer, Dali::ClippingBox>;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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( &layer, &Layer::SetClippingBox, clippingbox );
const Layer& layer,
Dali::Layer::Behavior behavior )
{
- typedef MessageValue1< Layer, Dali::Layer::Behavior > LocalType;
+ using LocalType = MessageValue1<Layer, Dali::Layer::Behavior>;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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( &layer, &Layer::SetBehavior, behavior );
*/
inline void SetDepthTestDisabledMessage( EventThreadServices& eventThreadServices, const Layer& layer, bool disable )
{
- typedef MessageValue1< Layer, bool > LocalType;
+ using LocalType = MessageValue1<Layer, bool>;
// Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+ uint32_t* 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( &layer, &Layer::SetDepthTestDisabled, disable );
// Template specialisation for OwnerPointer<Layer>, because delete is protected
template <>
-void OwnerPointer<Dali::Internal::SceneGraph::Layer>::Reset();
-
+inline void OwnerPointer<Dali::Internal::SceneGraph::Layer>::Reset()
+{
+ if (mObject != NULL)
+ {
+ Dali::Internal::SceneGraph::Node::Delete(mObject);
+ mObject = NULL;
+ }
+}
} // namespace Internal
} // namespace Dali