removing use of using namespace std;
[platform/core/uifw/dali-core.git] / dali / internal / update / nodes / scene-graph-layer.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/update/nodes/scene-graph-layer.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 namespace SceneGraph
31 {
32
33 SceneGraph::Layer* Layer::New()
34 {
35   return new Layer();
36 }
37
38 Layer::Layer()
39 : mSortFunction( Dali::Layer::ZValue ),
40   mClippingBox( 0,0,0,0 ),
41   mLastCamera(0),
42   mIsClipping( false ),
43   mDepthTestDisabled( false ),
44   mIsDefaultSortFunction( true )
45 {
46   // layer starts off dirty
47   mAllChildTransformsClean[ 0 ] = false;
48   mAllChildTransformsClean[ 1 ] = false;
49 }
50
51 Layer::~Layer()
52 {
53 }
54
55 void Layer::SetSortFunction( Dali::Layer::SortFunctionType function )
56 {
57   if( mSortFunction != function )
58   {
59     // is a custom sort function used
60     if( function != Dali::Layer::ZValue )
61     {
62       mIsDefaultSortFunction = false;
63     }
64     else
65     {
66       mIsDefaultSortFunction = true;
67     }
68
69     // changing the sort function makes the layer dirty
70     mAllChildTransformsClean[ 0 ] = false;
71     mAllChildTransformsClean[ 1 ] = false;
72     mSortFunction = function;
73   }
74 }
75
76 void Layer::SetClipping(bool enabled)
77 {
78   mIsClipping = enabled;
79 }
80
81 void Layer::SetClippingBox(const Dali::ClippingBox& box)
82 {
83   mClippingBox.Set(box.x, box.y, box.width, box.height);
84 }
85
86 void Layer::SetDepthTestDisabled( bool disable )
87 {
88   mDepthTestDisabled = disable;
89 }
90
91 bool Layer::IsDepthTestDisabled() const
92 {
93   return mDepthTestDisabled;
94 }
95
96 } // namespace SceneGraph
97
98 } // namespace Internal
99
100 } // namespace Dali