remove (unnecessarily) exported signal and action names
[platform/core/uifw/dali-core.git] / dali / internal / event / render-tasks / render-task-impl.cpp
index 791ab34..5976370 100644 (file)
@@ -1,24 +1,26 @@
-//
-// 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) 2014 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/event/render-tasks/render-task-impl.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/type-registry.h>
 #include <dali/internal/common/event-to-update.h>
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/actors/camera-actor-impl.h>
@@ -48,13 +50,21 @@ namespace Internal
 namespace // For internal properties
 {
 
-const std::string DEFAULT_PROPERTY_NAMES[] =
+// Signals
+
+const char* const SIGNAL_FINISHED = "finished";
+
+TypeRegistration mType( typeid( Dali::RenderTask ), typeid( Dali::BaseHandle ), NULL );
+
+SignalConnectorType signalConnector1( mType, SIGNAL_FINISHED, &RenderTask::DoConnectSignal );
+
+const char* DEFAULT_PROPERTY_NAMES[] =
 {
   "viewport-position",
   "viewport-size",
   "clear-color"
 };
-const int DEFAULT_PROPERTY_COUNT = sizeof( DEFAULT_PROPERTY_NAMES ) / sizeof( std::string );
+const int DEFAULT_PROPERTY_COUNT = sizeof( DEFAULT_PROPERTY_NAMES ) / sizeof( DEFAULT_PROPERTY_NAMES[0]);
 
 const Property::Type DEFAULT_PROPERTY_TYPES[DEFAULT_PROPERTY_COUNT] =
 {
@@ -65,8 +75,6 @@ const Property::Type DEFAULT_PROPERTY_TYPES[DEFAULT_PROPERTY_COUNT] =
 
 }// unnamed namespace
 
-RenderTask::DefaultPropertyLookup* RenderTask::sDefaultPropertyLookup = NULL;
-
 RenderTask* RenderTask::New( bool isSystemLevel )
 {
   RenderTask* task( new RenderTask( ThreadLocalStorage::Get().GetEventToUpdate(), isSystemLevel ) );
@@ -284,6 +292,25 @@ bool RenderTask::GetClearEnabled() const
   return mClearEnabled;
 }
 
+void RenderTask::SetCullMode( bool mode )
+{
+  if ( mCullMode != mode )
+  {
+    mCullMode = mode;
+
+    if ( mSceneObject )
+    {
+      // mSceneObject is being used in a separate thread; queue a message to set the value
+      SetCullModeMessage( mEventToUpdate, *mSceneObject, mCullMode );
+    }
+  }
+}
+
+bool RenderTask::GetCullMode() const
+{
+  return mCullMode;
+}
+
 void RenderTask::SetRefreshRate( unsigned int refreshRate )
 {
   DALI_LOG_TRACE_METHOD_FMT(gLogRender, "this:%p  rate:%d\n", this, refreshRate);
@@ -404,6 +431,7 @@ SceneGraph::RenderTask* RenderTask::CreateSceneObject()
   SetExclusiveMessage( mEventToUpdate, *mSceneObject, mExclusive );
   SetClearColorMessage(  mEventToUpdate, *mSceneObject, mClearColor );
   SetClearEnabledMessage(  mEventToUpdate, *mSceneObject, mClearEnabled );
+  SetCullModeMessage(  mEventToUpdate, *mSceneObject, mCullMode );
   SetRefreshRateMessage(  mEventToUpdate, *mSceneObject, mRefreshRate );
 
   // Caller takes ownership
@@ -433,11 +461,6 @@ void RenderTask::DiscardSceneObject()
  ********************************************************************************
  ********************************************************************************/
 
-bool RenderTask::IsSceneObjectRemovable() const
-{
-  return false; // The scene object is permanently "on stage" whilst this object is alive
-}
-
 unsigned int RenderTask::GetDefaultPropertyCount() const
 {
   return DEFAULT_PROPERTY_COUNT;
@@ -453,7 +476,7 @@ void RenderTask::GetDefaultPropertyIndices( Property::IndexContainer& indices )
   }
 }
 
-const std::string& RenderTask::GetDefaultPropertyName( Property::Index index ) const
+const char* RenderTask::GetDefaultPropertyName( Property::Index index ) const
 {
   if( index < DEFAULT_PROPERTY_COUNT )
   {
@@ -461,9 +484,7 @@ const std::string& RenderTask::GetDefaultPropertyName( Property::Index index ) c
   }
   else
   {
-    // index out of range..return empty string
-    static const std::string INVALID_PROPERTY_NAME;
-    return INVALID_PROPERTY_NAME;
+    return NULL;
   }
 }
 
@@ -471,36 +492,32 @@ Property::Index RenderTask::GetDefaultPropertyIndex(const std::string& name) con
 {
   Property::Index index = Property::INVALID_INDEX;
 
-  // Lazy initialization of static sDefaultPropertyLookup
-  if (!sDefaultPropertyLookup)
+  // Look for name in default properties
+  for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
   {
-    sDefaultPropertyLookup = new DefaultPropertyLookup();
-
-    for (int i=0; i<DEFAULT_PROPERTY_COUNT; ++i)
+    if( 0 == strcmp( name.c_str(), DEFAULT_PROPERTY_NAMES[ i ] ) ) // dont want to convert rhs to string
     {
-      (*sDefaultPropertyLookup)[DEFAULT_PROPERTY_NAMES[i]] = i;
+      index = i;
+      break;
     }
   }
-  DALI_ASSERT_DEBUG( NULL != sDefaultPropertyLookup );
-
-  // Look for name in default properties
-  DefaultPropertyLookup::const_iterator result = sDefaultPropertyLookup->find( name );
-  if ( sDefaultPropertyLookup->end() != result )
-  {
-    index = result->second;
-  }
 
   return index;
 }
 
 bool RenderTask::IsDefaultPropertyWritable(Property::Index index) const
 {
-  return true;
+  return true; // all properties writable
 }
 
 bool RenderTask::IsDefaultPropertyAnimatable(Property::Index index) const
 {
-  return true;
+  return true; // all properties animatable
+}
+
+bool RenderTask::IsDefaultPropertyAConstraintInput( Property::Index index ) const
+{
+  return true; // all properties can be used as constraint input
 }
 
 Property::Type RenderTask::GetDefaultPropertyType(Property::Index index) const
@@ -535,21 +552,14 @@ void RenderTask::SetDefaultProperty( Property::Index index, const Property::Valu
       SetClearColor( property.Get<Vector4>() );
       break;
     }
-
     default:
     {
-      DALI_ASSERT_ALWAYS(false && "RenderTask property index out of range"); // should not come here
+      // nothing to do
       break;
     }
   }
 }
 
-void RenderTask::SetCustomProperty( Property::Index /*index*/, const CustomProperty& /*entry*/, const Property::Value& /*value*/ )
-{
-  // TODO: support them, it doesn't hurt.
-  DALI_ASSERT_ALWAYS( 0 && "RenderTask does not support custom properties");
-}
-
 Property::Value RenderTask::GetDefaultProperty(Property::Index index) const
 {
   Property::Value value;
@@ -583,12 +593,6 @@ Property::Value RenderTask::GetDefaultProperty(Property::Index index) const
   return value;
 }
 
-void RenderTask::InstallSceneObjectProperty( SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index )
-{
-  // TODO: support them, it doesn't hurt.
-  DALI_ASSERT_ALWAYS( 0 && "RenderTask does not support custom properties" );
-}
-
 const SceneGraph::PropertyOwner* RenderTask::GetSceneObject() const
 {
   return mSceneObject;
@@ -672,16 +676,16 @@ void RenderTask::EmitSignalFinish()
 {
   DALI_LOG_INFO(gLogRender, Debug::General, "RenderTask::EmitSignalFinish(this:%p)\n", this);
 
-  if( !mSignalFinishedV2.Empty() )
+  if( !mSignalFinished.Empty() )
   {
     Dali::RenderTask handle( this );
-    mSignalFinishedV2.Emit(handle );
+    mSignalFinished.Emit(handle );
   }
 }
 
-Dali::RenderTask::RenderTaskSignalV2& RenderTask::FinishedSignal()
+Dali::RenderTask::RenderTaskSignalType& RenderTask::FinishedSignal()
 {
-  return mSignalFinishedV2;
+  return mSignalFinished;
 }
 
 bool RenderTask::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
@@ -689,7 +693,7 @@ bool RenderTask::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface
   bool connected( true );
   RenderTask* renderTask = dynamic_cast<RenderTask*>(object);
 
-  if ( Dali::RenderTask::SIGNAL_FINISHED == signalName )
+  if ( 0 == strcmp( signalName.c_str(), SIGNAL_FINISHED ) )
   {
     renderTask->FinishedSignal().Connect( tracker, functor );
   }
@@ -715,6 +719,7 @@ RenderTask::RenderTask( EventToUpdate& eventToUpdate, bool isSystemLevel )
   mExclusive( Dali::RenderTask::DEFAULT_EXCLUSIVE ),
   mInputEnabled( Dali::RenderTask::DEFAULT_INPUT_ENABLED ),
   mClearEnabled( Dali::RenderTask::DEFAULT_CLEAR_ENABLED ),
+  mCullMode( Dali::RenderTask::DEFAULT_CULL_MODE ),
   mIsSystemLevel( isSystemLevel )
 {
   DALI_LOG_INFO(gLogRender, Debug::General, "RenderTask::RenderTask(this:%p)\n", this);