2 * Copyright (c) 2014 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()
40 : mSortFunction( Internal::Layer::ZValue ),
41 mClippingBox( 0,0,0,0 ),
43 mBehavior( Dali::Layer::LAYER_2D ),
45 mDepthTestDisabled( false ),
46 mIsDefaultSortFunction( true )
48 // layer starts off dirty
49 mAllChildTransformsClean[ 0 ] = false;
50 mAllChildTransformsClean[ 1 ] = false;
57 void Layer::SetSortFunction( Dali::Layer::SortFunctionType function )
59 if( mSortFunction != function )
61 // is a custom sort function used
62 if( function != Internal::Layer::ZValue )
64 mIsDefaultSortFunction = false;
68 mIsDefaultSortFunction = true;
71 // changing the sort function makes the layer dirty
72 mAllChildTransformsClean[ 0 ] = false;
73 mAllChildTransformsClean[ 1 ] = false;
74 mSortFunction = function;
78 void Layer::SetClipping(bool enabled)
80 mIsClipping = enabled;
83 void Layer::SetClippingBox(const Dali::ClippingBox& box)
85 mClippingBox.Set(box.x, box.y, box.width, box.height);
88 void Layer::SetBehavior( Dali::Layer::Behavior behavior )
93 void Layer::SetDepthTestDisabled( bool disable )
95 mDepthTestDisabled = disable;
98 bool Layer::IsDepthTestDisabled() const
100 return ( mBehavior == Dali::Layer::LAYER_2D ) || mDepthTestDisabled;
103 void Layer::ClearRenderables()
105 stencilRenderables.Clear();
106 colorRenderables.Clear();
107 overlayRenderables.Clear();
110 } // namespace SceneGraph
112 } // namespace Internal