[Tizen] Implement partial update
[platform/core/uifw/dali-core.git] / dali / internal / update / nodes / scene-graph-layer.cpp
old mode 100644 (file)
new mode 100755 (executable)
index a42715a..d23419c
@@ -1,28 +1,27 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // CLASS HEADER
 #include <dali/internal/update/nodes/scene-graph-layer.h>
+#include <dali/internal/event/actors/layer-impl.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
 
-
-using namespace std;
-
 namespace Dali
 {
 
@@ -34,15 +33,24 @@ namespace SceneGraph
 
 SceneGraph::Layer* Layer::New()
 {
+  // Layers are currently heap allocated, unlike Nodes which are in a memory pool
+  // However Node::Delete( layer ) will correctly delete a layer / node depending on type
   return new Layer();
 }
 
 Layer::Layer()
-: mSortFunction( Dali::Layer::ZValue ),
+: Node(),
+  mSortFunction( Internal::Layer::ZValue ),
   mClippingBox( 0,0,0,0 ),
+  mLastCamera( NULL ),
+  mBehavior( Dali::Layer::LAYER_UI ),
   mIsClipping( false ),
-  mDepthTestDisabled( false )
+  mDepthTestDisabled( true ),
+  mIsDefaultSortFunction( true )
 {
+  // set a flag the node to say this is a layer
+  mIsLayer = true;
+
   // layer starts off dirty
   mAllChildTransformsClean[ 0 ] = false;
   mAllChildTransformsClean[ 1 ] = false;
@@ -56,6 +64,17 @@ void Layer::SetSortFunction( Dali::Layer::SortFunctionType function )
 {
   if( mSortFunction != function )
   {
+    SetPropertyDirty( true );
+    // is a custom sort function used
+    if( function != Internal::Layer::ZValue )
+    {
+      mIsDefaultSortFunction = false;
+    }
+    else
+    {
+      mIsDefaultSortFunction = true;
+    }
+
     // changing the sort function makes the layer dirty
     mAllChildTransformsClean[ 0 ] = false;
     mAllChildTransformsClean[ 1 ] = false;
@@ -66,16 +85,25 @@ void Layer::SetSortFunction( Dali::Layer::SortFunctionType function )
 void Layer::SetClipping(bool enabled)
 {
   mIsClipping = enabled;
+  SetPropertyDirty( true );
 }
 
 void Layer::SetClippingBox(const Dali::ClippingBox& box)
 {
   mClippingBox.Set(box.x, box.y, box.width, box.height);
+  SetPropertyDirty( true );
+}
+
+void Layer::SetBehavior( Dali::Layer::Behavior behavior )
+{
+  mBehavior = behavior;
+  SetPropertyDirty( true );
 }
 
 void Layer::SetDepthTestDisabled( bool disable )
 {
   mDepthTestDisabled = disable;
+  SetPropertyDirty( true );
 }
 
 bool Layer::IsDepthTestDisabled() const
@@ -83,6 +111,12 @@ bool Layer::IsDepthTestDisabled() const
   return mDepthTestDisabled;
 }
 
+void Layer::ClearRenderables()
+{
+  colorRenderables.Clear();
+  overlayRenderables.Clear();
+}
+
 } // namespace SceneGraph
 
 } // namespace Internal