Changed STEREO_HORIZONTAL view mode to work with landscape orientation
[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
25 using namespace std;
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 namespace SceneGraph
34 {
35
36 SceneGraph::Layer* Layer::New()
37 {
38   return new Layer();
39 }
40
41 Layer::Layer()
42 : mSortFunction( Dali::Layer::ZValue ),
43   mClippingBox( 0,0,0,0 ),
44   mLastCamera(0),
45   mIsClipping( false ),
46   mDepthTestDisabled( false ),
47   mIsDefaultSortFunction( true )
48 {
49   // layer starts off dirty
50   mAllChildTransformsClean[ 0 ] = false;
51   mAllChildTransformsClean[ 1 ] = false;
52 }
53
54 Layer::~Layer()
55 {
56 }
57
58 void Layer::SetSortFunction( Dali::Layer::SortFunctionType function )
59 {
60   if( mSortFunction != function )
61   {
62     // is a custom sort function used
63     if( function != Dali::Layer::ZValue )
64     {
65       mIsDefaultSortFunction = false;
66     }
67     else
68     {
69       mIsDefaultSortFunction = true;
70     }
71
72     // changing the sort function makes the layer dirty
73     mAllChildTransformsClean[ 0 ] = false;
74     mAllChildTransformsClean[ 1 ] = false;
75     mSortFunction = function;
76   }
77 }
78
79 void Layer::SetClipping(bool enabled)
80 {
81   mIsClipping = enabled;
82 }
83
84 void Layer::SetClippingBox(const Dali::ClippingBox& box)
85 {
86   mClippingBox.Set(box.x, box.y, box.width, box.height);
87 }
88
89 void Layer::SetDepthTestDisabled( bool disable )
90 {
91   mDepthTestDisabled = disable;
92 }
93
94 bool Layer::IsDepthTestDisabled() const
95 {
96   return mDepthTestDisabled;
97 }
98
99 } // namespace SceneGraph
100
101 } // namespace Internal
102
103 } // namespace Dali