Revert "[4.0] Fast bounding-box clipping feature" 17/154817/1
authortaeyoon0.lee <taeyoon0.lee@samsung.com>
Wed, 11 Oct 2017 09:05:56 +0000 (18:05 +0900)
committertaeyoon0.lee <taeyoon0.lee@samsung.com>
Wed, 11 Oct 2017 09:06:06 +0000 (18:06 +0900)
This reverts commit 99a35a3c51003271ea8a106f85fb09a8587c3a8a.

Change-Id: Ie63757d8ffe5ca7930d7422cbc4bed36aa234502

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.h
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control-impl.h

index 02439bc..c4bc01d 100644 (file)
@@ -85,7 +85,6 @@ void TestGlAbstraction::Initialize()
   mEnableDisableTrace.Reset();
   mShaderTrace.Reset();
   mStencilFunctionTrace.Reset();
-  mScissorTrace.Reset();
   mTextureTrace.Reset();
   mTexParamaterTrace.Reset();
   mDrawTrace.Reset();
index b306c3e..8408b10 100644 (file)
@@ -949,15 +949,6 @@ public:
     mScissorParams.y = y;
     mScissorParams.width = width;
     mScissorParams.height = height;
-
-    std::stringstream out;
-    out << x << ", " << y << ", " << width << ", " << height;
-    TraceCallStack::NamedParams namedParams;
-    namedParams["x"] = ToString( x );
-    namedParams["y"] = ToString( y );
-    namedParams["width"] = ToString( width );
-    namedParams["height"] = ToString( height );
-    mScissorTrace.PushCall( "Scissor", out.str(), namedParams );
   }
 
   inline void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
@@ -1960,11 +1951,6 @@ public: // TEST FUNCTIONS
   inline void ResetStencilFunctionCallStack() { mStencilFunctionTrace.Reset(); }
   inline TraceCallStack& GetStencilFunctionTrace() { return mStencilFunctionTrace; }
 
-  //Methods for Scissor verification
-  inline void EnableScissorCallTrace(bool enable) { mScissorTrace.Enable(enable); }
-  inline void ResetScissorCallStack() { mScissorTrace.Reset(); }
-  inline TraceCallStack& GetScissorTrace() { return mScissorTrace; }
-
   //Methods for Uniform function verification
   inline void EnableSetUniformCallTrace(bool enable) { mSetUniformTrace.Enable(enable); }
   inline void ResetSetUniformCallStack() { mSetUniformTrace.Reset(); }
@@ -2203,7 +2189,6 @@ private:
   TraceCallStack mDrawTrace;
   TraceCallStack mDepthFunctionTrace;
   TraceCallStack mStencilFunctionTrace;
-  TraceCallStack mScissorTrace;
   TraceCallStack mSetUniformTrace;
 
   // Shaders & Uniforms
index 23f392a..05f7ab3 100644 (file)
@@ -60,9 +60,15 @@ namespace
 Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_CONTROL_VISUALS");
 #endif
 
+DALI_ENUM_TO_STRING_TABLE_BEGIN( CLIPPING_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, DISABLED )
+DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, CLIP_CHILDREN )
+DALI_ENUM_TO_STRING_TABLE_END( CLIPPING_MODE )
+
 } // unnamed namespace
 
 
+
 Toolkit::Control Control::New()
 {
   // Create the implementation, temporarily owned on stack
@@ -476,22 +482,6 @@ void Control::EmitKeyInputFocusSignal( bool focusGained )
   }
 }
 
-void Control::CreateClippingRenderer()
-{
-  // We want to add a transparent background if we do not have one for clipping.
-  Actor self( Self() );
-  int clippingMode = ClippingMode::DISABLED;
-  if( self.GetProperty( Actor::Property::CLIPPING_MODE ).Get( clippingMode ) )
-  {
-    if( ( clippingMode != ClippingMode::DISABLED ) &&
-        mImpl->mVisuals.Empty() &&
-        ( self.GetRendererCount() == 0u ) )
-    {
-      SetBackgroundColor( Color::TRANSPARENT );
-    }
-  }
-}
-
 void Control::OnStageConnection( int depth )
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageConnection number of registered visuals(%d)\n",  mImpl->mVisuals.Size() );
@@ -508,8 +498,21 @@ void Control::OnStageConnection( int depth )
     }
   }
 
-  // The clipping renderer is only created if required.
-  CreateClippingRenderer();
+  if( mImpl->mVisuals.Empty() && ! self.GetRendererCount() )
+  {
+    Property::Value clippingValue = self.GetProperty( Actor::Property::CLIPPING_MODE );
+    int clippingMode = ClippingMode::DISABLED;
+    if( clippingValue.Get( clippingMode ) )
+    {
+      // Add a transparent background if we do not have any renderers or visuals so we clip our children
+
+      if( clippingMode == ClippingMode::CLIP_CHILDREN )
+      {
+        // Create a transparent background visual which will also get staged.
+        SetBackgroundColor( Color::TRANSPARENT );
+      }
+    }
+  }
 }
 
 void Control::OnStageDisconnection()
@@ -541,12 +544,24 @@ void Control::OnChildRemove(Actor& child)
 
 void Control::OnPropertySet( Property::Index index, Property::Value propertyValue )
 {
-  // If the clipping mode has been set, we may need to create a renderer.
-  // Only do this if we are already on-stage as the OnStageConnection will handle the off-stage clipping controls.
-  if( ( index == Actor::Property::CLIPPING_MODE ) && Self().OnStage() )
+  Actor self( Self() );
+  if( index == Actor::Property::CLIPPING_MODE )
   {
-    // Note: This method will handle whether creation of the renderer is required.
-    CreateClippingRenderer();
+    // Only set the background if we're already on the stage and have no renderers or visuals
+
+    if( mImpl->mVisuals.Empty() && ! self.GetRendererCount() && self.OnStage() )
+    {
+      ClippingMode::Type clippingMode = ClippingMode::DISABLED;
+      if( Scripting::GetEnumerationProperty< ClippingMode::Type >( propertyValue, CLIPPING_MODE_TABLE, CLIPPING_MODE_TABLE_COUNT, clippingMode ) )
+      {
+        // Add a transparent background if we do not have one so we clip children
+
+        if( clippingMode == ClippingMode::CLIP_CHILDREN )
+        {
+          SetBackgroundColor( Color::TRANSPARENT );
+        }
+      }
+    }
   }
 }
 
index dcb9201..9a1e560 100644 (file)
@@ -679,12 +679,6 @@ public: // API for derived classes to override
 
 private:
 
-  /**
-   * @brief Creates a clipping renderer if required.
-   * (EG. If no renders exist and clipping is enabled).
-   */
-  void CreateClippingRenderer();
-
   /// @cond internal
   // Undefined
   DALI_INTERNAL Control( const Control& );