2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/update/nodes/scene-graph-layer.h>
20 #include <dali/internal/event/actors/layer-impl.h>
23 #include <dali/public-api/common/dali-common.h>
34 SceneGraph::Layer* Layer::New()
36 // Layers are currently heap allocated, unlike Nodes which are in a memory pool
37 // However Node::Delete( layer ) will correctly delete a layer / node depending on type
43 mSortFunction( Internal::Layer::ZValue ),
44 mClippingBox( 0,0,0,0 ),
45 mLastCamera( nullptr ),
46 mBehavior( Dali::Layer::LAYER_UI ),
48 mDepthTestDisabled( true ),
49 mIsDefaultSortFunction( true )
51 // set a flag the node to say this is a layer
54 // layer starts off dirty
55 mAllChildTransformsClean[ 0 ] = false;
56 mAllChildTransformsClean[ 1 ] = false;
59 Layer::~Layer() = default;
61 void Layer::SetSortFunction( Dali::Layer::SortFunctionType function )
63 if( mSortFunction != function )
65 // is a custom sort function used
66 if( function != Internal::Layer::ZValue )
68 mIsDefaultSortFunction = false;
72 mIsDefaultSortFunction = true;
75 // changing the sort function makes the layer dirty
76 mAllChildTransformsClean[ 0 ] = false;
77 mAllChildTransformsClean[ 1 ] = false;
78 mSortFunction = function;
82 void Layer::SetClipping(bool enabled)
84 mIsClipping = enabled;
87 void Layer::SetClippingBox(const Dali::ClippingBox& box)
89 mClippingBox.Set(box.x, box.y, box.width, box.height);
92 void Layer::SetBehavior( Dali::Layer::Behavior behavior )
97 void Layer::SetDepthTestDisabled( bool disable )
99 mDepthTestDisabled = disable;
102 bool Layer::IsDepthTestDisabled() const
104 return mDepthTestDisabled;
107 void Layer::ClearRenderables()
109 colorRenderables.Clear();
110 overlayRenderables.Clear();
113 } // namespace SceneGraph
115 } // namespace Internal