Merge "Even if ELLIPSIS is set to false and ENABLE_AUTO_SCROLL is set to true, Ellips...
authorjoogab yun <joogab.yun@samsung.com>
Wed, 27 May 2020 00:28:05 +0000 (00:28 +0000)
committerGerrit Code Review <gerrit@review>
Wed, 27 May 2020 00:28:05 +0000 (00:28 +0000)
automated-tests/src/dali-toolkit/utc-Dali-GaussianBlurView.cpp
dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h
dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index 0a483a0..afc6aee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -190,6 +190,46 @@ int UtcDaliGaussianBlurActivateDeactivate(void)
 }
 
 // Positive test case for a method
+int UtcDaliGaussianBlurActivateDeactivateRepeat(void)
+{
+  ToolkitTestApplication application;
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+  tet_infoline("UtcDaliGaussianBlurActivateDeactivateRepeat");
+
+  Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New();
+  DALI_TEST_CHECK( view );
+
+  view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+  view.SetSize(Stage::GetCurrent().GetSize());
+  view.Add(Actor::New());
+  Stage::GetCurrent().Add(view);
+  view.Activate();
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_CHECK( gl.GetLastGenTextureId() == 3 );
+
+  view.Deactivate();
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_CHECK( gl.GetLastGenTextureId() == 3 );
+
+  view.Activate();
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_CHECK( gl.GetLastGenTextureId() == 6 );
+
+  END_TEST;
+}
+
+// Positive test case for a method
 int UtcDaliGaussianBlurViewSetGetBackgroundColor(void)
 {
   ToolkitTestApplication application;
@@ -229,10 +269,10 @@ int UtcDaliGaussianBlurViewSetGetRenderTarget(void)
   END_TEST;
 }
 
-int UtcDaliGaussianBlurViewActivateOnce(void)
+int UtcDaliGaussianBlurViewActivateOnce1(void)
 {
   ToolkitTestApplication application;
-  tet_infoline("UtcDaliGaussianBlurActivateOnce");
+  tet_infoline("UtcDaliGaussianBlurActivateOnce1");
 
   Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(5, 1.5f, Pixel::RGB888, 0.5f, 0.5f, true);
   DALI_TEST_CHECK( view );
@@ -253,6 +293,39 @@ int UtcDaliGaussianBlurViewActivateOnce(void)
   END_TEST;
 }
 
+// Positive test case for a method
+int UtcDaliGaussianBlurActivateOnce2(void)
+{
+  ToolkitTestApplication application;
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+  tet_infoline("UtcDaliGaussianBlurActivateOnce2");
+
+  Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New();
+  DALI_TEST_CHECK( view );
+
+  view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+  view.SetSize(Stage::GetCurrent().GetSize());
+  view.Add(Actor::New());
+  Stage::GetCurrent().Add(view);
+  view.ActivateOnce();
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_CHECK( gl.GetLastGenTextureId() == 3 );
+
+  view.ActivateOnce();
+
+  application.SendNotification();
+  application.Render(20);
+
+  DALI_TEST_CHECK( gl.GetLastGenTextureId() == 6 );
+
+  END_TEST;
+}
+
 int UtcDaliGaussianBlurViewFinishedSignalN(void)
 {
   ToolkitTestApplication application;
index 9b7824c..49b0205 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_GAUSSIAN_BLUR_EFFECT_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -226,7 +226,6 @@ public:
    * @brief Render the GaussianBlurView once.
    *
    * Must be called after you Add() it to the stage.
-   * Only works with a gaussian blur view created with blurUserImage = true.
    * Listen to the Finished signal to determine when the rendering has completed.
    * @SINCE_1_0.0
    */
index 62aca10..c4d744e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -386,72 +386,68 @@ void GaussianBlurView::OnChildRemove( Actor& child )
 
 void GaussianBlurView::AllocateResources()
 {
-  // size of render targets etc is based on the size of this actor, ignoring z
-  if(mTargetSize != mLastSize)
-  {
-    mLastSize = mTargetSize;
+  mLastSize = mTargetSize;
+
+  // get size of downsampled render targets
+  mDownsampledWidth = mTargetSize.width * mDownsampleWidthScale;
+  mDownsampledHeight = mTargetSize.height * mDownsampleHeightScale;
+
+  // Create and place a camera for the renders corresponding to the (potentially downsampled) render targets' size
+  mRenderDownsampledCamera.SetFieldOfView(ARBITRARY_FIELD_OF_VIEW);
+  // TODO: how do we pick a reasonable value for near clip? Needs to relate to normal camera the user renders with, but we don't have a handle on it
+  mRenderDownsampledCamera.SetNearClippingPlane(1.0f);
+  mRenderDownsampledCamera.SetAspectRatio(mDownsampledWidth / mDownsampledHeight);
+  mRenderDownsampledCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
 
-    // get size of downsampled render targets
-    mDownsampledWidth = mTargetSize.width * mDownsampleWidthScale;
-    mDownsampledHeight = mTargetSize.height * mDownsampleHeightScale;
+  mRenderDownsampledCamera.SetPosition(0.0f, 0.0f, ((mDownsampledHeight * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f)));
 
-    // Create and place a camera for the renders corresponding to the (potentially downsampled) render targets' size
-    mRenderDownsampledCamera.SetFieldOfView(ARBITRARY_FIELD_OF_VIEW);
+  // setup for normal operation
+  if(!mBlurUserImage)
+  {
+    // Create and place a camera for the children render, corresponding to its render target size
+    mRenderFullSizeCamera.SetFieldOfView(ARBITRARY_FIELD_OF_VIEW);
     // TODO: how do we pick a reasonable value for near clip? Needs to relate to normal camera the user renders with, but we don't have a handle on it
-    mRenderDownsampledCamera.SetNearClippingPlane(1.0f);
-    mRenderDownsampledCamera.SetAspectRatio(mDownsampledWidth / mDownsampledHeight);
-    mRenderDownsampledCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
+    mRenderFullSizeCamera.SetNearClippingPlane(1.0f);
+    mRenderFullSizeCamera.SetAspectRatio(mTargetSize.width / mTargetSize.height);
+    mRenderFullSizeCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
 
-    mRenderDownsampledCamera.SetPosition(0.0f, 0.0f, ((mDownsampledHeight * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f)));
+    float cameraPosConstraintScale = 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f);
+    mRenderFullSizeCamera.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale);
 
-    // setup for normal operation
-    if(!mBlurUserImage)
-    {
-      // Create and place a camera for the children render, corresponding to its render target size
-      mRenderFullSizeCamera.SetFieldOfView(ARBITRARY_FIELD_OF_VIEW);
-      // TODO: how do we pick a reasonable value for near clip? Needs to relate to normal camera the user renders with, but we don't have a handle on it
-      mRenderFullSizeCamera.SetNearClippingPlane(1.0f);
-      mRenderFullSizeCamera.SetAspectRatio(mTargetSize.width / mTargetSize.height);
-      mRenderFullSizeCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
-
-      float cameraPosConstraintScale = 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f);
-      mRenderFullSizeCamera.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale);
-
-      // create offscreen buffer of new size to render our child actors to
-      mRenderTargetForRenderingChildren = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
-      Texture texture = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
-      mRenderTargetForRenderingChildren.AttachColorTexture( texture );
-
-      // Set actor for performing a horizontal blur
-      SetRendererTexture( mHorizBlurActor.GetRendererAt(0), mRenderTargetForRenderingChildren );
-
-      // Create offscreen buffer for vert blur pass
-      mRenderTarget1 = FrameBuffer::New( mDownsampledWidth, mDownsampledHeight, FrameBuffer::Attachment::NONE );
-      texture = Texture::New(TextureType::TEXTURE_2D, mPixelFormat, unsigned(mDownsampledWidth), unsigned(mDownsampledHeight));
-      mRenderTarget1.AttachColorTexture( texture );
-
-      // use the completed blur in the first buffer and composite with the original child actors render
-      SetRendererTexture( mCompositingActor.GetRendererAt(0), mRenderTarget1 );
-
-      // set up target actor for rendering result, i.e. the blurred image
-      SetRendererTexture( mTargetActor.GetRendererAt(0), mRenderTargetForRenderingChildren );
-    }
+    // create offscreen buffer of new size to render our child actors to
+    mRenderTargetForRenderingChildren = FrameBuffer::New( mTargetSize.width, mTargetSize.height, FrameBuffer::Attachment::NONE );
+    Texture texture = Texture::New( TextureType::TEXTURE_2D, mPixelFormat, unsigned(mTargetSize.width), unsigned(mTargetSize.height) );
+    mRenderTargetForRenderingChildren.AttachColorTexture( texture );
 
-    // Create offscreen buffer for horiz blur pass
-    mRenderTarget2 = FrameBuffer::New( mDownsampledWidth, mDownsampledHeight, FrameBuffer::Attachment::NONE );
-    Texture texture = Texture::New(TextureType::TEXTURE_2D, mPixelFormat, unsigned(mDownsampledWidth), unsigned(mDownsampledHeight));
-    mRenderTarget2.AttachColorTexture( texture );
+    // Set actor for performing a horizontal blur
+    SetRendererTexture( mHorizBlurActor.GetRendererAt(0), mRenderTargetForRenderingChildren );
 
-    // size needs to match render target
-    mHorizBlurActor.SetSize(mDownsampledWidth, mDownsampledHeight);
+    // Create offscreen buffer for vert blur pass
+    mRenderTarget1 = FrameBuffer::New( mDownsampledWidth, mDownsampledHeight, FrameBuffer::Attachment::NONE );
+    texture = Texture::New(TextureType::TEXTURE_2D, mPixelFormat, unsigned(mDownsampledWidth), unsigned(mDownsampledHeight));
+    mRenderTarget1.AttachColorTexture( texture );
 
-    // size needs to match render target
-    mVertBlurActor.SetSize(mDownsampledWidth, mDownsampledHeight);
-    SetRendererTexture( mVertBlurActor.GetRendererAt(0), mRenderTarget2 );
+    // use the completed blur in the first buffer and composite with the original child actors render
+    SetRendererTexture( mCompositingActor.GetRendererAt(0), mRenderTarget1 );
 
-    // set gaussian blur up for new sized render targets
-    SetShaderConstants();
+    // set up target actor for rendering result, i.e. the blurred image
+    SetRendererTexture( mTargetActor.GetRendererAt(0), mRenderTargetForRenderingChildren );
   }
+
+  // Create offscreen buffer for horiz blur pass
+  mRenderTarget2 = FrameBuffer::New( mDownsampledWidth, mDownsampledHeight, FrameBuffer::Attachment::NONE );
+  Texture texture = Texture::New(TextureType::TEXTURE_2D, mPixelFormat, unsigned(mDownsampledWidth), unsigned(mDownsampledHeight));
+  mRenderTarget2.AttachColorTexture( texture );
+
+  // size needs to match render target
+  mHorizBlurActor.SetSize(mDownsampledWidth, mDownsampledHeight);
+
+  // size needs to match render target
+  mVertBlurActor.SetSize(mDownsampledWidth, mDownsampledHeight);
+  SetRendererTexture( mVertBlurActor.GetRendererAt(0), mRenderTarget2 );
+
+  // set gaussian blur up for new sized render targets
+  SetShaderConstants();
 }
 
 void GaussianBlurView::CreateRenderTasks()
@@ -470,6 +466,11 @@ void GaussianBlurView::CreateRenderTasks()
 
     mRenderChildrenTask.SetCameraActor(mRenderFullSizeCamera);
     mRenderChildrenTask.SetFrameBuffer( mRenderTargetForRenderingChildren );
+
+    if( mRenderOnce )
+    {
+      mRenderChildrenTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
+    }
   }
 
   // perform a horizontal blur targeting the second buffer
@@ -481,7 +482,7 @@ void GaussianBlurView::CreateRenderTasks()
   mHorizBlurTask.SetClearColor( mBackgroundColor );
   mHorizBlurTask.SetCameraActor(mRenderDownsampledCamera);
   mHorizBlurTask.SetFrameBuffer( mRenderTarget2 );
-  if( mRenderOnce && mBlurUserImage )
+  if( mRenderOnce || ( mRenderOnce && mBlurUserImage ) )
   {
     mHorizBlurTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
   }
@@ -502,7 +503,7 @@ void GaussianBlurView::CreateRenderTasks()
   {
     mVertBlurTask.SetFrameBuffer( mRenderTarget1 );
   }
-  if( mRenderOnce && mBlurUserImage )
+  if( mRenderOnce || ( mRenderOnce && mBlurUserImage ) )
   {
     mVertBlurTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
     mVertBlurTask.FinishedSignal().Connect( this, &GaussianBlurView::OnRenderTaskFinished );
@@ -518,6 +519,11 @@ void GaussianBlurView::CreateRenderTasks()
 
     mCompositeTask.SetCameraActor(mRenderFullSizeCamera);
     mCompositeTask.SetFrameBuffer( mRenderTargetForRenderingChildren );
+
+    if( mRenderOnce )
+    {
+      mCompositeTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
+    }
   }
 }
 
@@ -533,31 +539,37 @@ void GaussianBlurView::RemoveRenderTasks()
 
 void GaussianBlurView::Activate()
 {
-  // make sure resources are allocated and start the render tasks processing
-  Self().Add( mInternalRoot );
-  AllocateResources();
-  CreateRenderTasks();
-  mActivated = true;
+  if( !mActivated )
+  {
+    // make sure resources are allocated and start the render tasks processing
+    Self().Add( mInternalRoot );
+    AllocateResources();
+    CreateRenderTasks();
+    mActivated = true;
+  }
 }
 
 void GaussianBlurView::ActivateOnce()
 {
-  DALI_ASSERT_ALWAYS(mBlurUserImage); // Only works with blurring image mode.
+  Deactivate();
   mRenderOnce = true;
   Activate();
 }
 
 void GaussianBlurView::Deactivate()
 {
-  // stop render tasks processing
-  // Note: render target resources are automatically freed since we set the Image::Unused flag
-  mInternalRoot.Unparent();
-  RemoveRenderTasks();
-  mRenderTargetForRenderingChildren.Reset();
-  mRenderTarget1.Reset();
-  mRenderTarget2.Reset();
-  mRenderOnce = false;
-  mActivated = false;
+  if( mActivated )
+  {
+    // stop render tasks processing
+    // Note: render target resources are automatically freed since we set the Image::Unused flag
+    mInternalRoot.Unparent();
+    mRenderTargetForRenderingChildren.Reset();
+    mRenderTarget1.Reset();
+    mRenderTarget2.Reset();
+    RemoveRenderTasks();
+    mRenderOnce = false;
+    mActivated = false;
+  }
 }
 
 void GaussianBlurView::SetBlurBellCurveWidth(float blurBellCurveWidth)
index b05ea6e..3c84e6a 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 9;
-const unsigned int TOOLKIT_MICRO_VERSION = 12;
+const unsigned int TOOLKIT_MICRO_VERSION = 13;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 0c0dcc3..d6653cc 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    1.9.12
+Version:    1.9.13
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT