[dali_2.0.50] Merge branch 'devel/master' 36/265836/1
authorDavid Steele <david.steele@samsung.com>
Fri, 29 Oct 2021 09:06:29 +0000 (10:06 +0100)
committerDavid Steele <david.steele@samsung.com>
Fri, 29 Oct 2021 09:06:30 +0000 (10:06 +0100)
Change-Id: Id0e853383ee10fe39a634a57bf3ee94e286eb5c5

29 files changed:
automated-tests/src/dali-scene-loader/utc-Dali-StringCallback.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-canvas-renderer.cpp
automated-tests/src/dali-toolkit/utc-Dali-CanvasView.cpp
automated-tests/src/dali-toolkit/utc-Dali-Transition.cpp
dali-toolkit/devel-api/controls/control-devel.cpp
dali-toolkit/devel-api/controls/control-devel.h
dali-toolkit/internal/controls/canvas-view/canvas-view-impl.cpp
dali-toolkit/internal/controls/canvas-view/canvas-view-impl.h
dali-toolkit/internal/controls/canvas-view/canvas-view-rasterize-thread.cpp
dali-toolkit/internal/controls/canvas-view/canvas-view-rasterize-thread.h
dali-toolkit/internal/controls/control/control-data-impl.cpp
dali-toolkit/internal/controls/control/control-data-impl.h
dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp
dali-toolkit/internal/controls/image-view/image-view-impl.cpp
dali-toolkit/internal/controls/image-view/image-view-impl.h
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp
dali-toolkit/internal/controls/table-view/table-view-impl.cpp
dali-toolkit/internal/graphics/shaders/color-visual-shader.frag
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/internal/transition/transition-impl.cpp
dali-toolkit/internal/transition/transition-impl.h
dali-toolkit/internal/visuals/visual-base-impl.cpp
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control-impl.h
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/public-api/transition/transition.cpp
dali-toolkit/public-api/transition/transition.h
packaging/dali-toolkit.spec

index acd5183..113f40a 100644 (file)
@@ -41,6 +41,6 @@ int UtcDaliUtilsDefaultStringCallback(void)
 {
   InstallLogFunction(TestLogFunction);
   DefaultErrorCallback("Hello world!");
-  DALI_TEST_EQUAL(std::string(sBuffer), "2: DefaultErrorCallback Hello world!");
+  DALI_TEST_EQUAL(std::string(sBuffer), "2: string-callback.cpp: DefaultErrorCallback(26) > Hello world!");
   END_TEST;
 }
index 56c0cd8..43aa8ce 100644 (file)
@@ -39,7 +39,7 @@ class CanvasRenderer: public Dali::BaseObject
 public:
   CanvasRenderer( const Vector2& size )
   : mDrawable(nullptr),
-    mPixelBuffer( Devel::PixelBuffer::New(size.width, size.height, Dali::Pixel::RGBA8888) ),
+    mTexture ( Dali::Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, size.width, size.height ) ),
     mSize(size),
     mViewBox(size)
   {
@@ -59,6 +59,11 @@ public:
      return true;
   }
 
+  Dali::Texture GetRasterizedTexture()
+  {
+    return mTexture;
+  }
+
   bool Rasterize()
   {
      return true;
@@ -97,12 +102,6 @@ public:
     return false;
   }
 
-  Devel::PixelBuffer GetPixelBuffer()
-  {
-    return mPixelBuffer;
-  }
-
-
   bool SetSize(Vector2 size)
   {
     mSize = size;
@@ -137,7 +136,7 @@ public:
 
 public:
    Dali::CanvasRenderer::Drawable* mDrawable;
-   Devel::PixelBuffer mPixelBuffer;
+   Dali::Texture mTexture;
    Vector2 mSize;
    Vector2 mViewBox;
 };
@@ -200,9 +199,9 @@ bool CanvasRenderer::Rasterize()
   return Internal::Adaptor::GetImplementation(*this).Rasterize();
 }
 
-Devel::PixelBuffer CanvasRenderer::GetPixelBuffer()
+Dali::Texture CanvasRenderer::GetRasterizedTexture()
 {
-  return Internal::Adaptor::GetImplementation(*this).GetPixelBuffer();
+  return Internal::Adaptor::GetImplementation(*this).GetRasterizedTexture();
 }
 
 bool CanvasRenderer::AddDrawable(Dali::CanvasRenderer::Drawable& drawable)
index 36cf1df..cee41e0 100644 (file)
@@ -302,42 +302,6 @@ int UtcDaliCanvasViewRasterizeTaskGetCanvasViewP(void)
   END_TEST;
 }
 
-int UtcDaliCanvasViewRasterizeTaskGetBufferSizeP(void)
-{
-  ToolkitTestApplication application;
-
-  Dali::Toolkit::Internal::CanvasView* dummyInternalCanvasView = new Dali::Toolkit::Internal::CanvasView(Vector2(100,100));
-  DALI_TEST_CHECK( dummyInternalCanvasView );
-
-  Dali::CanvasRenderer dummyCanvasRenderer = Dali::CanvasRenderer::New(Vector2(100, 100));
-  DALI_TEST_CHECK( dummyCanvasRenderer );
-
-  IntrusivePtr<Dali::Toolkit::Internal::CanvasRendererRasterizingTask> task = new Dali::Toolkit::Internal::CanvasRendererRasterizingTask(dummyInternalCanvasView, dummyCanvasRenderer);
-  DALI_TEST_CHECK( task );
-
-  //There is no rasterized buffer.
-  DALI_TEST_EQUALS( task->GetBufferSize(), Vector2(0, 0), TEST_LOCATION );
-
-  END_TEST;
-}
-
-int UtcDaliCanvasViewRasterizeTaskGetPixelDataP(void)
-{
-
-  Dali::Toolkit::Internal::CanvasView* dummyInternalCanvasView = new Dali::Toolkit::Internal::CanvasView(Vector2(100,100));
-  DALI_TEST_CHECK( dummyInternalCanvasView );
-
-  Dali::CanvasRenderer dummyCanvasRenderer = Dali::CanvasRenderer::New(Vector2(100, 100));
-  DALI_TEST_CHECK( dummyCanvasRenderer );
-
-  IntrusivePtr<Dali::Toolkit::Internal::CanvasRendererRasterizingTask> task = new Dali::Toolkit::Internal::CanvasRendererRasterizingTask(dummyInternalCanvasView, dummyCanvasRenderer);
-  DALI_TEST_CHECK( task );
-
-  DALI_TEST_EQUALS( task->GetPixelData(), PixelData(), TEST_LOCATION );
-
-  END_TEST;
-}
-
 int UtcDaliCanvasViewRasterizeThreadP(void)
 {
   ToolkitTestApplication application;
@@ -488,13 +452,13 @@ int UtcDaliCanvasViewRasterizeThreadRasterizationCompletedSignalP(void)
 {
   ToolkitTestApplication application;
 
-  Dali::Toolkit::Internal::CanvasView* dummyInternalCanvasView = new Dali::Toolkit::Internal::CanvasView(Vector2(100,100));
-  DALI_TEST_CHECK( dummyInternalCanvasView );
+  Dali::Toolkit::CanvasView canvasView = Dali::Toolkit::CanvasView::New(Vector2(100, 100));
+  Dali::Toolkit::Internal::CanvasView& dummyInternalCanvasView = GetImpl(canvasView);
 
   Dali::CanvasRenderer dummyCanvasRenderer = Dali::CanvasRenderer::New(Vector2(100, 100));
   DALI_TEST_CHECK( dummyCanvasRenderer );
 
-  IntrusivePtr<Dali::Toolkit::Internal::CanvasRendererRasterizingTask> task = new Dali::Toolkit::Internal::CanvasRendererRasterizingTask(dummyInternalCanvasView, dummyCanvasRenderer);
+  IntrusivePtr<Dali::Toolkit::Internal::CanvasRendererRasterizingTask> task = new Dali::Toolkit::Internal::CanvasRendererRasterizingTask(&dummyInternalCanvasView, dummyCanvasRenderer);
   DALI_TEST_CHECK( task );
 
   Dali::Toolkit::Internal::CanvasViewRasterizeThread *dummyThread = new Dali::Toolkit::Internal::CanvasViewRasterizeThread();
@@ -504,10 +468,10 @@ int UtcDaliCanvasViewRasterizeThreadRasterizationCompletedSignalP(void)
 
   dummyThread->Process(false);
 
-  PixelData pixelData = CreatePixelData( 100, 100 );
+  auto texture = Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, 100, 100 );
 
-  dummyThread->RasterizationCompletedSignal().Connect(dummyInternalCanvasView, &Dali::Toolkit::Internal::CanvasView::ApplyRasterizedImage);
-  dummyThread->RasterizationCompletedSignal().Emit(pixelData);
+  dummyThread->RasterizationCompletedSignal().Connect(&dummyInternalCanvasView, &Dali::Toolkit::Internal::CanvasView::ApplyRasterizedImage);
+  dummyThread->RasterizationCompletedSignal().Emit(texture);
 
   application.SendNotification();
   application.Render();
index 7e36d2c..ef1eb2c 100755 (executable)
@@ -118,7 +118,7 @@ int UtcDaliTransitionSetGetProperty01(void)
   application.SendNotification();
   application.Render(20);
 
-  Transition transition = Transition::New(control1, control2, TimePeriod(-0.1f, -0.1f));
+  Transition transition = Transition::New(control1, control2, true, TimePeriod(-0.1f, -0.1f));
   TimePeriod timePeriod = transition.GetTimePeriod();
   DALI_TEST_EQUALS(0.0f, timePeriod.durationSeconds, TEST_LOCATION);
   DALI_TEST_EQUALS(0.0f, timePeriod.delaySeconds, TEST_LOCATION);
@@ -178,7 +178,7 @@ int UtcDaliTransitionSetGetProperty02(void)
   application.SendNotification();
   application.Render(20);
 
-  Transition transition = Transition::New(control1, control2, TimePeriod(-0.1f));
+  Transition transition = Transition::New(control1, control2, true, TimePeriod(-0.1f));
   TimePeriod timePeriod = transition.GetTimePeriod();
   DALI_TEST_EQUALS(0.0f, timePeriod.durationSeconds, TEST_LOCATION);
   DALI_TEST_EQUALS(0.0f, timePeriod.delaySeconds, TEST_LOCATION);
@@ -268,7 +268,7 @@ int UtcDaliTransitionBetweenControlPair(void)
   application.SendNotification();
   application.Render(20);
 
-  Transition transition = Transition::New(control1, control2, TimePeriod(0.5f));
+  Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
   TransitionSet transitionSet = TransitionSet::New();
   transitionSet.AddTransition(transition);
   transitionSet.Play();
@@ -333,6 +333,185 @@ int UtcDaliTransitionBetweenControlPair(void)
   END_TEST;
 }
 
+int UtcDaliTransitionBetweenControlPair2(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTransitionBetweenControlPair2 - source target will be transitioned.");
+
+  Vector3 sourcePosition(100, 200, 0);
+  Vector3 sourceSize(150, 150, 0);
+  Vector3 sourceScale(1, 2, 0);
+  Vector4 sourceColor(1.0f, 1.0f, 1.0f, 0.5f);
+  float sourceOpacity(0.5f);
+  float sourceRadius(30.f);
+  float sourceBorderlineWidth(60.0f);
+  Vector4 sourceBorderlineColor(1.0f, 0.0f, 0.0f, 1.0f);
+  float sourceBorderlineOffset(1.f);
+  Vector4 sourceRadiusV4 = Vector4(sourceRadius, sourceRadius, sourceRadius, sourceRadius);
+
+  Vector3 destinationPosition(50, 50, 0);
+  Vector3 destinationSize(120, 120, 0);
+  Vector3 destinationScale(2, 1, 0);
+  Vector4 destinationColor(1.0f, 0.5f, 1.0f, 0.8f);
+  float destinationOpacity(0.8f);
+  float destinationRadius(50.f);
+  float destinationBorderlineWidth(80.0f);
+  Vector4 destinationBorderlineColor(0.5f, 1.0f, 0.5f, 0.3f);
+  float destinationBorderlineOffset(-1.0f);
+  Vector4 destinationRadiusV4 = Vector4(destinationRadius, destinationRadius, destinationRadius, destinationRadius);
+
+  Control control1 = Control::New();
+  control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  control1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  control1.SetProperty(Actor::Property::POSITION, sourcePosition);
+  control1.SetProperty(Actor::Property::SIZE, sourceSize);
+  control1.SetProperty(Actor::Property::SCALE, sourceScale);
+  control1.SetProperty(Actor::Property::COLOR, sourceColor);
+  control1.SetProperty(Actor::Property::OPACITY, sourceOpacity);
+  Property::Map controlProperty1;
+  controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
+  controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+  controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceRadius);
+  controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
+  controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
+  controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
+  control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
+
+  Control control2 = Control::New();
+  control2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+  control2.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::CENTER);
+  control2.SetProperty(Actor::Property::POSITION, destinationPosition);
+  control2.SetProperty(Actor::Property::SIZE, destinationSize);
+  control2.SetProperty(Actor::Property::SCALE, destinationScale);
+  control2.SetProperty(Actor::Property::COLOR, destinationColor);
+  control2.SetProperty(Actor::Property::OPACITY, destinationOpacity);
+  Property::Map controlProperty2;
+  controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
+  controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
+  controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
+  controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
+  controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
+  controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
+  control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
+
+  DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
+  Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
+  Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
+  DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
+  float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
+  DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+  Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
+  DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+  float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
+  DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
+
+  application.GetScene().Add(control1);
+  application.GetScene().Add(control2);
+
+  application.SendNotification();
+  application.Render(20);
+
+  Transition transition = Transition::New(control1, control2, false, TimePeriod(0.5f));
+  TransitionSet transitionSet = TransitionSet::New();
+  transitionSet.AddTransition(transition);
+  transitionSet.Play();
+
+  bool signalReceived(false);
+  TransitionFinishCheck finishCheck(signalReceived);
+  transitionSet.FinishedSignal().Connect(&application, finishCheck);
+
+  application.SendNotification();
+  application.Render(50);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+
+  DALI_TEST_NOT_EQUALS(destinationPosition, control1.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
+  DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
+
+  Dali::Renderer renderer = control1.GetRendererAt(0);
+  Property::Index index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
+  cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+  DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
+
+  index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
+  borderlineWidth = renderer.GetCurrentProperty<float>(index);
+  DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
+
+  index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
+  borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+  DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
+
+  index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
+  borderlineOffset = renderer.GetCurrentProperty<float>(index);
+  DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render(700);
+
+  // We did expect the animation to finish
+  application.SendNotification();
+  finishCheck.CheckSignalReceived();
+
+  // After the transition is finished,
+  // every current and renderer propeties of control1 are equal to destination properties.
+  DALI_TEST_EQUALS(destinationPosition, control1.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
+  DALI_TEST_EQUALS(destinationSize, control1.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
+  DALI_TEST_EQUALS(destinationScale, control1.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
+  DALI_TEST_EQUALS(destinationColor, control1.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
+  DALI_TEST_EQUALS(destinationOpacity, control1.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+  DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
+  renderer = control1.GetRendererAt(0);
+  index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
+  cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+  DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
+
+  index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
+  borderlineWidth = renderer.GetCurrentProperty<float>(index);
+  DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+
+  index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
+  borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+  DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+
+  index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
+  borderlineOffset = renderer.GetCurrentProperty<float>(index);
+  DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
+
+  // every actor properties of control1 are returned to the source properties.
+  DALI_TEST_EQUALS(sourcePosition, control1.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
+  DALI_TEST_EQUALS(sourceSize, control1.GetProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
+  DALI_TEST_EQUALS(sourceScale, control1.GetProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
+  DALI_TEST_EQUALS(sourceColor, control1.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
+  DALI_TEST_EQUALS(sourceOpacity, control1.GetProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render(20);
+
+  // after next update, renderer properties are returned to the source properties.
+  DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
+  renderer = control1.GetRendererAt(0);
+  index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
+  cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+  DALI_TEST_EQUALS(sourceRadiusV4, cornerRadius, TEST_LOCATION);
+
+  index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
+  borderlineWidth = renderer.GetCurrentProperty<float>(index);
+  DALI_TEST_EQUALS(sourceBorderlineWidth, borderlineWidth, TEST_LOCATION);
+
+  index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
+  borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+  DALI_TEST_EQUALS(sourceBorderlineColor, borderlineColor, TEST_LOCATION);
+
+  index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
+  borderlineOffset = renderer.GetCurrentProperty<float>(index);
+  DALI_TEST_EQUALS(sourceBorderlineOffset, borderlineOffset, TEST_LOCATION);
+
+  END_TEST;
+}
+
 int UtcDaliTransitionBetweenControlPairWithoutEmptySourceBackground(void)
 {
   ToolkitTestApplication application;
@@ -377,7 +556,7 @@ int UtcDaliTransitionBetweenControlPairWithoutEmptySourceBackground(void)
   application.SendNotification();
   application.Render(20);
 
-  Transition transition = Transition::New(control1, control2, TimePeriod(0.5f));
+  Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
   TransitionSet transitionSet = TransitionSet::New();
   transitionSet.AddTransition(transition);
   transitionSet.Play();
@@ -474,7 +653,7 @@ int UtcDaliTransitionBetweenImageViewPair(void)
   Vector3 startWorldPosition = control1.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
   Vector3 finishWorldPosition = control2.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
 
-  Transition transition = Transition::New(control1, control2, TimePeriod(0.5f));
+  Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
   TransitionSet transitionSet = TransitionSet::New();
   transitionSet.AddTransition(transition);
   transitionSet.Play();
@@ -562,7 +741,7 @@ int UtcDaliTransitionBetweenImageViewPairWithDelay(void)
   Vector3 startWorldPosition = control1.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
   Vector3 finishWorldPosition = control2.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
 
-  Transition transition = Transition::New(control1, control2, TimePeriod(0.5f, 0.5f));
+  Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f, 0.5f));
   TransitionSet transitionSet = TransitionSet::New();
   transitionSet.AddTransition(transition);
   transitionSet.Play();
@@ -654,7 +833,7 @@ int UtcDaliTransitionBetweenControlPairWithTree(void)
   application.SendNotification();
   application.Render(20);
 
-  Transition transition = Transition::New(control1, control2, TimePeriod(0.5f));
+  Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
   TransitionSet transitionSet = TransitionSet::New();
   transitionSet.AddTransition(transition);
   transitionSet.Play();
@@ -721,7 +900,7 @@ int UtcDaliTransitionBetweenControlPairWithTreeWithChild(void)
   application.SendNotification();
   application.Render(20);
 
-  Transition transition = Transition::New(control1, control2, TimePeriod(0.5f));
+  Transition transition = Transition::New(control1, control2, true, TimePeriod(0.5f));
   transition.TransitionWithChild(true);
   TransitionSet transitionSet = TransitionSet::New();
   transitionSet.AddTransition(transition);
@@ -801,7 +980,7 @@ int UtcDaliTransitionBetweenControlPairWithTreeWithoutPositionInheritance(void)
   control3.SetProperty(Actor::Property::INHERIT_ORIENTATION, true);
   control3.SetProperty(Actor::Property::INHERIT_SCALE, true);
 
-  transition = Transition::New(control1, control3, TimePeriod(0.5f));
+  transition = Transition::New(control1, control3, true, TimePeriod(0.5f));
   transitionSet = TransitionSet::New();
   transitionSet.AddTransition(transition);
   transitionSet.Play();
@@ -892,7 +1071,7 @@ int UtcDaliTransitionBetweenControlPairWithTreeWithoutOrientationInheritance(voi
   bool signalReceived(false);
   TransitionFinishCheck finishCheck(signalReceived);
 
-  transition = Transition::New(control1, control3, TimePeriod(0.5f));
+  transition = Transition::New(control1, control3, true, TimePeriod(0.5f));
   transitionSet = TransitionSet::New();
   transitionSet.AddTransition(transition);
   transitionSet.Play();
@@ -978,7 +1157,7 @@ int UtcDaliTransitionBetweenControlPairWithTreeWithoutScaleInheritance(void)
   bool signalReceived(false);
   TransitionFinishCheck finishCheck(signalReceived);
 
-  transition = Transition::New(control1, control3, TimePeriod(0.5f));
+  transition = Transition::New(control1, control3, true, TimePeriod(0.5f));
   transitionSet = TransitionSet::New();
   transitionSet.AddTransition(transition);
   transitionSet.Play();
index 55becb3..dc7a128 100644 (file)
@@ -122,19 +122,6 @@ Dali::Property GetVisualProperty(Control control, Dali::Property::Index index, D
   return controlDataImpl.GetVisualProperty(index, visualPropertyKey);
 }
 
-void CreateTransitions(Control control, Dali::Animation& animation, Dali::Toolkit::Control source, AlphaFunction alphaFunction, TimePeriod timePeriod)
-{
-  if(animation)
-  {
-    // make visual transition of control visual.
-    Internal::Control&       internalControl = Toolkit::Internal::GetImplementation(control);
-    Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(internalControl);
-    controlDataImpl.MakeVisualTransition(animation, source, Toolkit::Control::Property::BACKGROUND, alphaFunction, timePeriod);
-    controlDataImpl.MakeVisualTransition(animation, source, Toolkit::DevelControl::Property::SHADOW, alphaFunction, timePeriod);
-    internalControl.OnCreateTransitions(animation, source, alphaFunction, timePeriod);
-  }
-}
-
 static Toolkit::Internal::Control::Impl* GetControlImplementation(Dali::Actor actor)
 {
   Dali::Toolkit::Control control = Toolkit::Control::DownCast(actor);
index 36b83f9..8877646 100644 (file)
@@ -371,20 +371,6 @@ DALI_TOOLKIT_API VisualEventSignalType& VisualEventSignal(Control control);
 DALI_TOOLKIT_API Dali::Property GetVisualProperty(Control control, Dali::Property::Index index, Dali::Property::Key visualPropertyKey);
 
 /**
- * @brief Retrieve visual/renderer property animation between this Control and source control.
- * Input animation must be created before this method called.
- * And the animations between this method created are added the input animation.
- * This method generates visual/renderer property animation but not creates Actor property animation.
- *
- * @param[in] control The control
- * @param[in] animation generated animation
- * @param[in] source source control of the animation.
- * @param[in] alphaFunction AlphaFunction of the animation
- * @param[in] timePeriod TimePeriod of the animation
- */
-DALI_TOOLKIT_API void CreateTransitions(Control control, Dali::Animation& animation, Dali::Toolkit::Control source, AlphaFunction alphaFunction, TimePeriod timePeriod);
-
-/**
  * @brief The signal is emmited as a succession of "activate" signal send by accessibility client.
  * @return The signal to connect to
  */
index 5741a42..1540b02 100644 (file)
@@ -196,43 +196,21 @@ void CanvasView::AddRasterizationTask()
   }
 }
 
-void CanvasView::ApplyRasterizedImage(PixelData rasterizedPixelData)
+void CanvasView::ApplyRasterizedImage(Texture rasterizedTexture)
 {
-  if(rasterizedPixelData)
+  if (rasterizedTexture && rasterizedTexture.GetWidth() != 0 && rasterizedTexture.GetHeight() != 0)
   {
-    auto rasterizedPixelDataWidth  = rasterizedPixelData.GetWidth();
-    auto rasterizedPixelDataHeight = rasterizedPixelData.GetHeight();
-
-    if(rasterizedPixelDataWidth > 0 && rasterizedPixelDataHeight > 0)
+    if(!mTextureSet)
     {
-      if(!mTexture || mTexture.GetWidth() != rasterizedPixelDataWidth || mTexture.GetHeight() != rasterizedPixelDataHeight)
-      {
-        mTexture = Texture::New(TextureType::TEXTURE_2D, rasterizedPixelData.GetPixelFormat(), rasterizedPixelDataWidth, rasterizedPixelDataHeight);
-        mTexture.Upload(rasterizedPixelData);
-
-        if(!mTextureSet)
-        {
-          mTextureSet       = TextureSet::New();
-          Geometry geometry = VisualFactoryCache::CreateQuadGeometry();
-          Shader   shader   = Shader::New(SHADER_CANVAS_VIEW_VERT, SHADER_CANVAS_VIEW_FRAG);
-          Renderer renderer = Renderer::New(geometry, shader);
-          renderer.SetTextures(mTextureSet);
-          renderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true);
-
-          Actor actor = Self();
-          if(actor)
-          {
-            actor.AddRenderer(renderer);
-          }
-        }
-        mTextureSet.SetTexture(0, mTexture);
-      }
-      else
-      {
-        //Update texture
-        mTexture.Upload(rasterizedPixelData);
-      }
+      mTextureSet       = TextureSet::New();
+      Geometry geometry = VisualFactoryCache::CreateQuadGeometry();
+      Shader   shader   = Shader::New(SHADER_CANVAS_VIEW_VERT, SHADER_CANVAS_VIEW_FRAG);
+      Renderer renderer = Renderer::New(geometry, shader);
+      renderer.SetTextures(mTextureSet);
+      renderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true);
+      Self().AddRenderer(renderer);
     }
+    mTextureSet.SetTexture(0, rasterizedTexture);
   }
 
   //If there are accumulated changes to CanvasRenderer during Rasterize, Rasterize once again.
index 6b6cf93..4e492eb 100644 (file)
@@ -135,9 +135,9 @@ public:
   /**
    * @bried Apply the rasterized image to the canvas view
    *
-   * @param[in] rasterizedPixelData The pixel buffer with the rasterized pixels
+   * @param[in] rasterizedTexture The texture with the rasterized pixels
    */
-  void ApplyRasterizedImage(PixelData rasterizedPixelData);
+  void ApplyRasterizedImage(Texture rasterizedTexture);
 
 private:
   CanvasView(const CanvasView&) = delete;
index 97835c5..ba3daae 100644 (file)
@@ -31,8 +31,7 @@ namespace Internal
 CanvasRendererRasterizingTask::CanvasRendererRasterizingTask(CanvasView* canvasView, CanvasRenderer canvasRenderer)
 : mCanvasView(canvasView),
   mCanvasRenderer(canvasRenderer),
-  mPixelData(PixelData()),
-  mBufferSize(0, 0)
+  mRasterizedTexture()
 {
 }
 
@@ -40,17 +39,7 @@ bool CanvasRendererRasterizingTask::Rasterize()
 {
   if(mCanvasRenderer && mCanvasRenderer.Rasterize())
   {
-    Devel::PixelBuffer pixbuf = mCanvasRenderer.GetPixelBuffer();
-    auto               width  = pixbuf.GetWidth();
-    auto               height = pixbuf.GetHeight();
-    if(width > 0 && height > 0)
-    {
-      mBufferSize.width  = width;
-      mBufferSize.height = height;
-
-      mPixelData = Devel::PixelBuffer::Convert(pixbuf);
-      return true;
-    }
+    return true;
   }
   return false;
 }
@@ -60,14 +49,9 @@ CanvasView* CanvasRendererRasterizingTask::GetCanvasView() const
   return mCanvasView.Get();
 }
 
-PixelData CanvasRendererRasterizingTask::GetPixelData() const
-{
-  return mPixelData;
-}
-
-Vector2 CanvasRendererRasterizingTask::GetBufferSize() const
+Texture CanvasRendererRasterizingTask::GetRasterizedTexture()
 {
-  return mBufferSize;
+  return mCanvasRenderer.GetRasterizedTexture();
 }
 
 CanvasViewRasterizeThread::CanvasViewRasterizeThread()
@@ -220,7 +204,7 @@ void CanvasViewRasterizeThread::ApplyRasterized()
 {
   while(CanvasRendererRasterizingTaskPtr task = NextCompletedTask())
   {
-    RasterizationCompletedSignal().Emit(task->GetPixelData());
+    RasterizationCompletedSignal().Emit(task->GetRasterizedTexture()); // Here texture get
   }
 
   UnregisterProcessor();
index 0c16fd9..f89bb91 100644 (file)
@@ -25,7 +25,6 @@
 #include <dali/devel-api/threading/thread.h>
 #include <dali/integration-api/adaptor-framework/log-factory-interface.h>
 #include <dali/public-api/common/intrusive-ptr.h>
-#include <dali/public-api/images/pixel-data.h>
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/rendering/texture-set.h>
 #include <memory>
@@ -81,15 +80,9 @@ public:
 
   /**
    * Get the rasterization result.
-   * @return The pixel data with the rasterized pixels.
+   * @return The texture with the rasterized pixels.
    */
-  PixelData GetPixelData() const;
-
-  /**
-   * Get size of rasterization result.
-   * @return The size of the pixel data.
-   */
-  Vector2 GetBufferSize() const;
+  Texture GetRasterizedTexture();
 
 private:
   // Undefined
@@ -101,8 +94,7 @@ private:
 private:
   CanvasViewPtr  mCanvasView;
   CanvasRenderer mCanvasRenderer;
-  PixelData      mPixelData;
-  Vector2        mBufferSize;
+  Texture        mRasterizedTexture;
 };
 
 /**
@@ -112,7 +104,7 @@ class CanvasViewRasterizeThread : public Thread, Integration::Processor
 {
 public:
   /// @brief ApplyRasterizedImage Event signal type
-  using RasterizationCompletedSignalType = Signal<void(PixelData)>;
+  using RasterizationCompletedSignalType = Signal<void(Texture)>;
 
 public:
   /**
index f9f4376..b81149c 100644 (file)
@@ -36,6 +36,7 @@
 #include <limits>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/visuals/visual-actions-devel.h>
 #include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
@@ -1970,115 +1971,46 @@ Dali::Property Control::Impl::GetVisualProperty(Dali::Property::Index index, Dal
   return Dali::Property(handle, Property::INVALID_INDEX);
 }
 
-void Control::Impl::MakeVisualTransition(Dali::Animation& animation, Dali::Toolkit::Control source, Dali::Property::Index visualIndex, AlphaFunction alphaFunction, TimePeriod timePeriod)
+void Control::Impl::CreateTransitions(std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& sourceProperties,
+                                      std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& destinationProperties,
+                                      Dali::Toolkit::Control source, Dali::Toolkit::Control destination)
 {
-  Dali::Toolkit::Control sourceHandle      = Dali::Toolkit::Control::DownCast(source);
-  Property::Map          sourceMap         = sourceHandle.GetProperty<Property::Map>(visualIndex);
-  Dali::Toolkit::Control destinationHandle = Dali::Toolkit::Control::DownCast(mControlImpl.Self());
-  Property::Map          destinationMap    = destinationHandle.GetProperty<Property::Map>(visualIndex);
-
-  Vector4 mixColor(1.0f, 1.0f, 1.0f, 1.0f);
-  Vector4 cornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
-  float   borderlineWidth(0.0f);
-  Vector4 borderlineColor(0.0f, 0.0f, 0.0f, 1.0f);
-  float   borderlineOffset(0.0f);
-
-  if(!destinationMap.Empty())
+  // Retrieves background properties to be transitioned.
+  Dali::Property::Map backgroundSourcePropertyMap, backgroundDestinationPropertyMap;
+  mControlImpl.MakeVisualTransition(backgroundSourcePropertyMap, backgroundDestinationPropertyMap, source, destination, Toolkit::Control::Property::BACKGROUND);
+  if(backgroundSourcePropertyMap.Count() > 0)
   {
-    static auto findValueVector4 = [](const Property::Map& map, Property::Index index, const Vector4& defaultValue = Vector4()) -> Vector4 {
-      Property::Value* propertyValue = map.Find(index);
-      if(propertyValue)
-      {
-        return propertyValue->Get<Vector4>();
-      }
-      return defaultValue;
-    };
-
-    static auto findValueFloat = [](const Property::Map& map, Property::Index index, const float& defaultValue = 0.0f) -> float {
-      Property::Value* propertyValue = map.Find(index);
-      if(propertyValue)
-      {
-        return propertyValue->Get<float>();
-      }
-      return defaultValue;
-    };
-
-    mixColor         = findValueVector4(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR, mixColor);
-    cornerRadius     = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, cornerRadius);
-    borderlineWidth  = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth);
-    borderlineColor  = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, borderlineColor);
-    borderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset);
-
-    if(sourceMap.Empty())
-    {
-      sourceMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
-      sourceMap.Insert(Dali::Toolkit::Visual::Property::MIX_COLOR, Color::TRANSPARENT);
-      sourceMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, cornerRadius);
-      sourceMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth);
-      sourceMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, borderlineColor);
-      sourceMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset);
-    }
-
-    Vector4 sourceMixColor         = findValueVector4(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR, mixColor);
-    Vector4 sourceCornerRadius     = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, cornerRadius);
-    float   sourceBorderlineWidth  = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth);
-    Vector4 sourceBorderlineColor  = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, borderlineColor);
-    float   sourceBorderlineOffset = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset);
-
-    std::vector<Dali::Property>                              properties;
-    std::vector<std::pair<Property::Value, Property::Value>> values;
-
-    if(Vector3(sourceMixColor) != Vector3(mixColor))
-    {
-      properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::Visual::Property::MIX_COLOR));
-      values.push_back(std::make_pair(Vector3(sourceMixColor), Vector3(mixColor)));
-    }
-
-    if(std::abs(sourceMixColor.a - mixColor.a) > Math::MACHINE_EPSILON_1)
-    {
-      properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::Visual::Property::OPACITY));
-      values.push_back(std::make_pair(sourceMixColor.a, mixColor.a));
-    }
-
-    if(sourceCornerRadius != cornerRadius)
-    {
-      properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS));
-      values.push_back(std::make_pair(sourceCornerRadius, cornerRadius));
-    }
+    sourceProperties.push_back(std::pair<Dali::Property::Index, Dali::Property::Map>(Toolkit::Control::Property::BACKGROUND, backgroundSourcePropertyMap));
+    destinationProperties.push_back(std::pair<Dali::Property::Index, Dali::Property::Map>(Toolkit::Control::Property::BACKGROUND, backgroundDestinationPropertyMap));
+  }
 
-    if(sourceBorderlineWidth != borderlineWidth)
-    {
-      properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH));
-      values.push_back(std::make_pair(sourceBorderlineWidth, borderlineWidth));
-    }
+  // Retrieves shadow properties to be transitioned.
+  Dali::Property::Map shadowSourcePropertyMap, shadowDestinationPropertyMap;
+  mControlImpl.MakeVisualTransition(shadowSourcePropertyMap, shadowDestinationPropertyMap, source, destination, Toolkit::DevelControl::Property::SHADOW);
+  if(shadowSourcePropertyMap.Count() > 0)
+  {
+    sourceProperties.push_back(std::pair<Dali::Property::Index, Dali::Property::Map>(Toolkit::DevelControl::Property::SHADOW, shadowSourcePropertyMap));
+    destinationProperties.push_back(std::pair<Dali::Property::Index, Dali::Property::Map>(Toolkit::DevelControl::Property::SHADOW, shadowDestinationPropertyMap));
+  }
 
-    if(sourceBorderlineColor != borderlineColor)
-    {
-      properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR));
-      values.push_back(std::make_pair(sourceBorderlineColor, borderlineColor));
-    }
+  // Retrieves transition from inherited class.
+  mControlImpl.OnCreateTransitions(sourceProperties, destinationProperties, source, destination);
+}
 
-    if(sourceBorderlineOffset != borderlineOffset)
+void Control::Impl::UpdateVisualProperties(const std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& properties)
+{
+  for(auto&& data : properties)
+  {
+    if(data.first == Toolkit::Control::Property::BACKGROUND)
     {
-      properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET));
-      values.push_back(std::make_pair(sourceBorderlineOffset, borderlineOffset));
+      DoAction(Toolkit::Control::Property::BACKGROUND, DevelVisual::Action::UPDATE_PROPERTY, data.second);
     }
-
-    for(uint32_t i = 0; i < properties.size(); ++i)
+    else if(data.first == Toolkit::DevelControl::Property::SHADOW)
     {
-      if(timePeriod.delaySeconds > 0.0f)
-      {
-        Dali::KeyFrames initialKeyframes = Dali::KeyFrames::New();
-        initialKeyframes.Add(0.0f, values[i].first);
-        initialKeyframes.Add(1.0f, values[i].first);
-        animation.AnimateBetween(properties[i], initialKeyframes, TimePeriod(timePeriod.delaySeconds));
-      }
-      Dali::KeyFrames keyframes = Dali::KeyFrames::New();
-      keyframes.Add(0.0f, values[i].first);
-      keyframes.Add(1.0f, values[i].second);
-      animation.AnimateBetween(properties[i], keyframes, alphaFunction, timePeriod);
+      DoAction(Toolkit::DevelControl::Property::SHADOW, DevelVisual::Action::UPDATE_PROPERTY, data.second);
     }
   }
+  mControlImpl.OnUpdateVisualProperties(properties);
 }
 
 void Control::Impl::EmitResourceReadySignal()
index 94da0fc..55c49a6 100644 (file)
@@ -393,16 +393,32 @@ public:
   Dali::Property GetVisualProperty(Dali::Property::Index index, Dali::Property::Key visualPropertyKey);
 
   /**
-   * @brief Make visual transition from source control to this control about specific Property::Index
-   * If both of source and this control have Property::Index property, than create animation between them.
+   * @brief Retrieves source and destination visual properties for the Transition of this Control.
+   * The properties of this Control will be transitioned from the propeties of source Control to that of destination control.
+   * If a property value is different between source and destination Control,
+   * the property information of each Control will be included in sourceProperties and destinationProperties.
    *
-   * @param[in] animation Return animation from source to this control.
-   * @param[in] source Source control to be used property animation.
-   * @param[in] visualIndex Property::Index to make animation.
-   * @param[in] alphaFunction alpha function of the animation.
-   * @param[in] timePeriod time period of the animation.
+   * @param[out] sourceProperties Source property list to be applied on this Control.
+   * @param[out] destinationProperties Destination property list to be applied on this Control.
+   * @param[in] source Source control of the animation.
+   * @param[in] destination Destination control of the animation.
+   *
+   * @note This method do not handle Actor properties.
+   * And the size and order of the sourceProperties and destinationProperties must be synchronized.
+   *
+   * This method triggers Control::OnCreateTransition().
+   */
+  void CreateTransitions(std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& sourceProperties,
+                         std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& destinationProperties,
+                         Dali::Toolkit::Control source, Dali::Toolkit::Control destination);
+
+  /**
+   * @brief Update visual properties.
+   * @param[in] properties Property list to be used to update visual properties of this Control.
+   *
+   * @note This method triggers Control::OnUpdateVisualProperties().
    */
-  void MakeVisualTransition(Dali::Animation& animation, Dali::Toolkit::Control source, Dali::Property::Index visualIndex, AlphaFunction alphaFunction, TimePeriod timePeriod);
+  void UpdateVisualProperties(const std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& properties);
 
   /**
    * @brief Gets the current control's accessible object.
index a3c092d..4a3b065 100644 (file)
@@ -39,7 +39,7 @@ namespace
 // currently not called from code so compiler will optimize these away, kept here for future debugging
 
 #define FLEX_CONTAINER_TAG "DALI Toolkit::FlexContainer "
-#define FC_LOG(fmt, args, ...) Debug::LogMessage(Debug::DebugInfo, FLEX_CONTAINER_TAG fmt, ##args)
+#define FC_LOG(fmt, args, ...) Debug::LogMessageWithFunctionLine(Debug::DebugInfo, FLEX_CONTAINER_TAG fmt, ##args)
 // #define FLEX_CONTAINER_DEBUG 1
 
 #if defined(FLEX_CONTAINER_DEBUG)
index e3701ec..1a653a1 100644 (file)
@@ -24,6 +24,7 @@
 #include <dali/public-api/object/type-registry.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/visuals/visual-actions-devel.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
@@ -284,114 +285,36 @@ void ImageView::OnRelayout(const Vector2& size, RelayoutContainer& container)
   }
 }
 
-void ImageView::OnCreateTransitions(Dali::Animation& animation, Dali::Toolkit::Control source, AlphaFunction alphaFunction, TimePeriod timePeriod)
+void ImageView::OnCreateTransitions(std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& sourceProperties,
+                                    std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& destinationProperties,
+                                    Dali::Toolkit::Control                                              source,
+                                    Dali::Toolkit::Control                                              destination)
 {
-  Dali::Toolkit::ImageView destinationHandle = Toolkit::ImageView(GetOwner());
-  Toolkit::Visual::Base    destinationVisual = DevelControl::GetVisual(GetImplementation(destinationHandle), Toolkit::ImageView::Property::IMAGE);
-  Property::Map            destinationMap;
-
-  if(!destinationVisual)
-  {
-    return;
-  }
-
-  destinationVisual.CreatePropertyMap(destinationMap);
-
-  static auto findValueVector4 = [](const Property::Map& map, Property::Index index, const Vector4& defaultValue = Vector4()) -> Vector4 {
-    Property::Value* propertyValue = map.Find(index);
-    if(propertyValue)
-    {
-      return propertyValue->Get<Vector4>();
-    }
-    return defaultValue;
-  };
-
-  static auto findValueFloat = [](const Property::Map& map, Property::Index index, const float& defaultValue = 0.0f) -> float {
-    Property::Value* propertyValue = map.Find(index);
-    if(propertyValue)
-    {
-      return propertyValue->Get<float>();
-    }
-    return defaultValue;
-  };
-
-  Vector4 sourceMixColor(0.0f, 0.0f, 0.0f, 0.0f);
-  Vector4 sourceCornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
-  float   sourceBorderlineWidth(0.0f);
-  Vector4 sourceBorderlineColor(0.0f, 0.0f, 0.0f, 1.0f);
-  float   sourceBorderlineOffset(0.0f);
-  Vector4 destinationMixColor         = findValueVector4(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR, sourceMixColor);
-  Vector4 destinationCornerRadius     = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceCornerRadius);
-  float   destinationBorderlineWidth  = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
-  Vector4 destinationBorderlineColor  = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
-  float   destinationBorderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
-
-  Dali::Toolkit::ImageView sourceHandle = Dali::Toolkit::ImageView::DownCast(source);
-  Toolkit::Visual::Base    sourceVisual;
-  Property::Map            sourceMap;
-
-  if(sourceHandle)
-  {
-    sourceVisual = DevelControl::GetVisual(GetImplementation(sourceHandle), Toolkit::ImageView::Property::IMAGE);
-  }
-
-  if(sourceVisual)
+  // Retrieves image properties to be transitioned.
+  Dali::Property::Map imageSourcePropertyMap, imageDestinationPropertyMap;
+  MakeVisualTransition(imageSourcePropertyMap, imageDestinationPropertyMap, source, destination, Toolkit::ImageView::Property::IMAGE);
+  if(imageSourcePropertyMap.Count() > 0)
   {
-    sourceVisual.CreatePropertyMap(sourceMap);
-    sourceMixColor         = findValueVector4(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR, sourceMixColor);
-    sourceCornerRadius     = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceCornerRadius);
-    sourceBorderlineWidth  = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
-    sourceBorderlineColor  = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
-    sourceBorderlineOffset = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
+    sourceProperties.push_back(std::pair<Dali::Property::Index, Dali::Property::Map>(Toolkit::ImageView::Property::IMAGE, imageSourcePropertyMap));
+    destinationProperties.push_back(std::pair<Dali::Property::Index, Dali::Property::Map>(Toolkit::ImageView::Property::IMAGE, imageDestinationPropertyMap));
   }
+}
 
-  std::vector<Dali::Property>                              properties;
-  std::vector<std::pair<Property::Value, Property::Value>> values;
-
-  if(Vector3(sourceMixColor) != Vector3(destinationMixColor))
-  {
-    properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::Visual::Property::MIX_COLOR));
-    values.push_back(std::make_pair(Vector3(sourceMixColor), Vector3(destinationMixColor)));
-  }
-  if(std::abs(sourceMixColor.a - destinationMixColor.a) > Math::MACHINE_EPSILON_1)
-  {
-    properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::Visual::Property::OPACITY));
-    values.push_back(std::make_pair(sourceMixColor.a, destinationMixColor.a));
-  }
-  if(sourceCornerRadius != destinationCornerRadius)
-  {
-    properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::CORNER_RADIUS));
-    values.push_back(std::make_pair(sourceCornerRadius, destinationCornerRadius));
-  }
-  if(sourceBorderlineWidth != destinationBorderlineWidth)
-  {
-    properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH));
-    values.push_back(std::make_pair(sourceBorderlineWidth, destinationBorderlineWidth));
-  }
-  if(sourceBorderlineColor != destinationBorderlineColor)
-  {
-    properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::BORDERLINE_COLOR));
-    values.push_back(std::make_pair(sourceBorderlineColor, destinationBorderlineColor));
-  }
-  if(sourceBorderlineOffset != destinationBorderlineOffset)
+void ImageView::OnUpdateVisualProperties(const std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& properties)
+{
+  Toolkit::Visual::Base visual = DevelControl::GetVisual(*this, Toolkit::ImageView::Property::IMAGE);
+  if(visual)
   {
-    properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET));
-    values.push_back(std::make_pair(sourceBorderlineOffset, destinationBorderlineOffset));
-  }
+    Dali::Toolkit::Control handle(GetOwner());
 
-  for(uint32_t i = 0; i < properties.size(); ++i)
-  {
-    if(timePeriod.delaySeconds > 0.0f)
+    for(auto&& data : properties)
     {
-      Dali::KeyFrames initialKeyframes = Dali::KeyFrames::New();
-      initialKeyframes.Add(0.0f, values[i].first);
-      initialKeyframes.Add(1.0f, values[i].first);
-      animation.AnimateBetween(properties[i], initialKeyframes, TimePeriod(timePeriod.delaySeconds));
+      if(data.first == Toolkit::ImageView::Property::IMAGE)
+      {
+        DevelControl::DoAction(handle, Toolkit::ImageView::Property::IMAGE, DevelVisual::Action::UPDATE_PROPERTY, data.second);
+        break;
+      }
     }
-    Dali::KeyFrames keyframes = Dali::KeyFrames::New();
-    keyframes.Add(0.0f, values[i].first);
-    keyframes.Add(1.0f, values[i].second);
-    animation.AnimateBetween(properties[i], keyframes, alphaFunction, timePeriod);
   }
 }
 
index 023930e..ef48839 100644 (file)
@@ -136,7 +136,15 @@ private: // From Control
   /**
    * @copydoc Toolkit::Control::OnCreateTransitions()
    */
-  virtual void OnCreateTransitions(Dali::Animation& animation, Dali::Toolkit::Control source, AlphaFunction alphaFunction, TimePeriod timePeriod) override;
+  virtual void OnCreateTransitions(std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& sourceProperties,
+                                   std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& destinationProperties,
+                                   Dali::Toolkit::Control                                              source,
+                                   Dali::Toolkit::Control                                              destination) override;
+
+  /**
+   * @copydoc Toolkit::Control::OnUpdateVisualProperties()
+   */
+  virtual void OnUpdateVisualProperties(const std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& properties) override;
 
 private:
   /**
index fa65e95..86cfc56 100644 (file)
@@ -43,7 +43,7 @@
 //#define ENABLED_SCROLL_STATE_LOGGING
 
 #ifdef ENABLED_SCROLL_STATE_LOGGING
-#define DALI_LOG_SCROLL_STATE(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, "%s:%d " format "\n", __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define DALI_LOG_SCROLL_STATE(format, ...) Dali::Integration::Log::LogMessageWithFunctionLine(Dali::Integration::Log::DebugInfo, "%s:%d " format "\n", __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
 #else
 #define DALI_LOG_SCROLL_STATE(format, ...)
 #endif
index 4b3e019..9aec5ba 100644 (file)
@@ -51,7 +51,7 @@ bool FitToChild(Actor actor, Dimension::Type dimension)
 // currently not called from code so compiler will optimize these away, kept here for future debugging
 
 #define TABLEVIEW_TAG "DALI Toolkit::TableView "
-#define TV_LOG(fmt, args, ...) Debug::LogMessage(Debug::DebugInfo, TABLEVIEW_TAG fmt, ##args)
+#define TV_LOG(fmt, args, ...) Debug::LogMessageWithFunctionLine(Debug::DebugInfo, TABLEVIEW_TAG fmt, ##args)
 //#define TABLEVIEW_DEBUG 1
 
 #if defined(TABLEVIEW_DEBUG)
index 13be4df..3e3d19d 100644 (file)
@@ -241,18 +241,18 @@ mediump float calculateBlurOpacity()
 
     // solve (v.x - x)^2 + (v.y - x)^2 = (cr / cy * x)^2
 #if IS_REQUIRED_ROUNDED_CORNER
-    // NOTE : lowspec HW cannot calculate here. need to reduce numeric error
-    mediump float A = (cr * cr - 2.0 * cy * cy);
-    mediump float B = cy * (v.x + v.y);
-    mediump float V = dot(v,v);
-    mediump float D = B * B + A * V;
+    // Note : lowspec HW cannot calculate here. need to reduce numeric error
+    highp float A = (cr * cr - 2.0 * cy * cy);
+    highp float B = cy * (v.x + v.y);
+    highp float V = dot(v,v);
+    highp float D = B * B + A * V;
     potential = V * (cr + cy) / (sqrt(D) + B);
 #else
     // We can simplify this value cause cy = 0.8 * blurRadius, cr = 1.2 * blurRadius
     // potential = 5.0*(sqrt(4.0*(v.x+v.y)^2 + dot(v,v)) - 2.0*(v.x+v.y));
     //           = 10.0*(v.x+v.y) * (sqrt(1.0 + (length(v) / (2.0*(v.x+v.y)))^2) - 1.0);
     //           = 10.0*(v.x+v.y) * (sqrt(1.25 - x + x^2) - 1.0);
-    //          ~= 10.0*(v.x+v.y) * (0.11803399 - 0.44721360x + 0.35777088x^2 - 0.14310x^3 + O(x^4)) (Taylor series)
+    //          ~= 10.0*(v.x+v.y) * (0.11803399 - 0.44721360x + 0.35777088x^2 - 0.14310x^3 + O(x^5)) (Taylor series)
     //          ~= -1.0557281 * (v.x + v.y) + 2.236068 * length(v) - ~~~ (here, x <= 0.5 * (1.0 - sqrt(0.5)) < 0.1464467)
     // Note : This simplify need cause we should use it on lowspec HW.
     mediump float x = 0.5 * (1.0 - length(v) / (v.x + v.y));
index 30c6e04..6e4d361 100644 (file)
@@ -46,48 +46,76 @@ constexpr float MAX_FLOAT = std::numeric_limits<float>::max();
 
 const std::string EMPTY_STRING("");
 
-int ConvertPixelToPint(float pixel)
+template<typename Type>
+void EnsureCreated(Type*& object)
 {
-  unsigned int                      horizontalDpi = 0u;
-  unsigned int                      verticalDpi   = 0u;
-  Dali::TextAbstraction::FontClient fontClient    = Dali::TextAbstraction::FontClient::Get();
-  fontClient.GetDpi(horizontalDpi, verticalDpi);
-
-  return (pixel * 72.f) / static_cast<float>(horizontalDpi);
+  if(!object)
+  {
+    object = new Type();
+  }
 }
 
-} // namespace
+template<typename Type>
+void EnsureCreated(std::unique_ptr<Type>& object)
+{
+  if(!object)
+  {
+    object = std::unique_ptr<Type>(new Type());
+  }
+}
 
-namespace Dali
+template<typename Type, typename Arg1>
+void EnsureCreated(Type*& object, Arg1 arg1)
 {
-namespace Toolkit
+  if(!object)
+  {
+    object = new Type(arg1);
+  }
+}
+
+template<typename Type, typename Arg1, typename Arg2>
+void EnsureCreated(Type*& object, Arg1 arg1, Arg2 arg2)
 {
-namespace Text
+  if(!object)
+  {
+    object = new Type(arg1, arg2);
+  }
+}
+
+float GetDpi()
 {
-// public : Constructor.
+  unsigned int                      horizontalDpi = 0u;
+  unsigned int                      verticalDpi   = 0u;
+  Dali::TextAbstraction::FontClient fontClient    = Dali::TextAbstraction::FontClient::Get();
+  fontClient.GetDpi(horizontalDpi, verticalDpi);
+  return static_cast<float>(horizontalDpi);
+}
 
-ControllerPtr Controller::New()
+float ConvertPixelToPoint(float pixel)
 {
-  return ControllerPtr(new Controller());
+  return pixel * 72.0f / GetDpi();
 }
 
-ControllerPtr Controller::New(ControlInterface* controlInterface)
+float ConvertPointToPixel(float point)
 {
-  return ControllerPtr(new Controller(controlInterface));
+  // Pixel size = Point size * DPI / 72.f
+  return point * GetDpi() / 72.0f;
 }
 
-ControllerPtr Controller::New(ControlInterface*           controlInterface,
-                              EditableControlInterface*   editableControlInterface,
-                              SelectableControlInterface* selectableControlInterface,
-                              AnchorControlInterface*     anchorControlInterface)
+void UpdateCursorPosition(Dali::Toolkit::Text::EventData* eventData)
 {
-  return ControllerPtr(new Controller(controlInterface,
-                                      editableControlInterface,
-                                      selectableControlInterface,
-                                      anchorControlInterface));
+  if(eventData && Dali::Toolkit::Text::EventData::IsEditingState(eventData->mState))
+  {
+    // Update the cursor position if it's in editing mode
+    eventData->mDecoratorUpdated     = true;
+    eventData->mUpdateCursorPosition = true; // Cursor position should be updated when the font size is updated.
+  }
 }
 
-// public : Configure the text controller.
+} // namespace
+
+namespace Dali::Toolkit::Text
+{
 
 void Controller::EnableTextInput(DecoratorPtr decorator, InputMethodContext& inputMethodContext)
 {
@@ -100,10 +128,7 @@ void Controller::EnableTextInput(DecoratorPtr decorator, InputMethodContext& inp
     return;
   }
 
-  if(NULL == mImpl->mEventData)
-  {
-    mImpl->mEventData = new EventData(decorator, inputMethodContext);
-  }
+  EnsureCreated(mImpl->mEventData, decorator, inputMethodContext);
 }
 
 void Controller::SetGlyphType(TextAbstraction::GlyphType glyphType)
@@ -147,24 +172,20 @@ void Controller::SetAutoScrollEnabled(bool enable)
 
   if(mImpl->mLayoutEngine.GetLayout() == Layout::Engine::SINGLE_LINE_BOX)
   {
+    mImpl->mOperationsPending = static_cast<OperationsMask>(mImpl->mOperationsPending |
+                                                            LAYOUT |
+                                                            ALIGN |
+                                                            UPDATE_LAYOUT_SIZE |
+                                                            REORDER);
+
     if(enable)
     {
       DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled for SINGLE_LINE_BOX\n");
-      mImpl->mOperationsPending = static_cast<OperationsMask>(mImpl->mOperationsPending |
-                                                              LAYOUT |
-                                                              ALIGN |
-                                                              UPDATE_LAYOUT_SIZE |
-                                                              UPDATE_DIRECTION |
-                                                              REORDER);
+      mImpl->mOperationsPending = static_cast<OperationsMask>(mImpl->mOperationsPending | UPDATE_DIRECTION);
     }
     else
     {
       DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled Disabling autoscroll\n");
-      mImpl->mOperationsPending = static_cast<OperationsMask>(mImpl->mOperationsPending |
-                                                              LAYOUT |
-                                                              ALIGN |
-                                                              UPDATE_LAYOUT_SIZE |
-                                                              REORDER);
     }
 
     mImpl->mIsAutoScrollEnabled = enable;
@@ -192,62 +213,42 @@ CharacterDirection Controller::GetAutoScrollDirection() const
 float Controller::GetAutoScrollLineAlignment() const
 {
   float offset = 0.f;
-
-  if(mImpl->mModel->mVisualModel &&
-     (0u != mImpl->mModel->mVisualModel->mLines.Count()))
+  if(mImpl->mModel->mVisualModel && (0u != mImpl->mModel->mVisualModel->mLines.Count()))
   {
     offset = (*mImpl->mModel->mVisualModel->mLines.Begin()).alignmentOffset;
   }
-
   return offset;
 }
 
 void Controller::SetHorizontalScrollEnabled(bool enable)
 {
-  if((NULL != mImpl->mEventData) &&
-     mImpl->mEventData->mDecorator)
+  if(mImpl->mEventData && mImpl->mEventData->mDecorator)
   {
     mImpl->mEventData->mDecorator->SetHorizontalScrollEnabled(enable);
   }
 }
+
 bool Controller::IsHorizontalScrollEnabled() const
 {
-  if((NULL != mImpl->mEventData) &&
-     mImpl->mEventData->mDecorator)
-  {
-    return mImpl->mEventData->mDecorator->IsHorizontalScrollEnabled();
-  }
-
-  return false;
+  return mImpl->mEventData && mImpl->mEventData->mDecorator && mImpl->mEventData->mDecorator->IsHorizontalScrollEnabled();
 }
 
 void Controller::SetVerticalScrollEnabled(bool enable)
 {
-  if((NULL != mImpl->mEventData) &&
-     mImpl->mEventData->mDecorator)
+  if(mImpl->mEventData && mImpl->mEventData->mDecorator)
   {
-    if(mImpl->mEventData->mDecorator)
-    {
-      mImpl->mEventData->mDecorator->SetVerticalScrollEnabled(enable);
-    }
+    mImpl->mEventData->mDecorator->SetVerticalScrollEnabled(enable);
   }
 }
 
 bool Controller::IsVerticalScrollEnabled() const
 {
-  if((NULL != mImpl->mEventData) &&
-     mImpl->mEventData->mDecorator)
-  {
-    return mImpl->mEventData->mDecorator->IsVerticalScrollEnabled();
-  }
-
-  return false;
+  return mImpl->mEventData && mImpl->mEventData->mDecorator && mImpl->mEventData->mDecorator->IsVerticalScrollEnabled();
 }
 
 void Controller::SetSmoothHandlePanEnabled(bool enable)
 {
-  if((NULL != mImpl->mEventData) &&
-     mImpl->mEventData->mDecorator)
+  if(mImpl->mEventData && mImpl->mEventData->mDecorator)
   {
     mImpl->mEventData->mDecorator->SetSmoothHandlePanEnabled(enable);
   }
@@ -255,13 +256,7 @@ void Controller::SetSmoothHandlePanEnabled(bool enable)
 
 bool Controller::IsSmoothHandlePanEnabled() const
 {
-  if((NULL != mImpl->mEventData) &&
-     mImpl->mEventData->mDecorator)
-  {
-    return mImpl->mEventData->mDecorator->IsSmoothHandlePanEnabled();
-  }
-
-  return false;
+  return mImpl->mEventData && mImpl->mEventData->mDecorator && mImpl->mEventData->mDecorator->IsSmoothHandlePanEnabled();
 }
 
 void Controller::SetMaximumNumberOfCharacters(Length maxCharacters)
@@ -278,12 +273,11 @@ void Controller::SetEnableCursorBlink(bool enable)
 {
   DALI_ASSERT_DEBUG(NULL != mImpl->mEventData && "TextInput disabled");
 
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     mImpl->mEventData->mCursorBlinkEnabled = enable;
 
-    if(!enable &&
-       mImpl->mEventData->mDecorator)
+    if(!enable && mImpl->mEventData->mDecorator)
     {
       mImpl->mEventData->mDecorator->StopCursorBlink();
     }
@@ -292,12 +286,7 @@ void Controller::SetEnableCursorBlink(bool enable)
 
 bool Controller::GetEnableCursorBlink() const
 {
-  if(NULL != mImpl->mEventData)
-  {
-    return mImpl->mEventData->mCursorBlinkEnabled;
-  }
-
-  return false;
+  return mImpl->mEventData && mImpl->mEventData->mCursorBlinkEnabled;
 }
 
 void Controller::SetMultiLineEnabled(bool enable)
@@ -367,9 +356,7 @@ void Controller::SetVerticalAlignment(VerticalAlignment::Type alignment)
   {
     // Set the alignment.
     mImpl->mModel->mVerticalAlignment = alignment;
-
     mImpl->mOperationsPending = static_cast<OperationsMask>(mImpl->mOperationsPending | ALIGN);
-
     mImpl->RequestRelayout();
   }
 }
@@ -484,19 +471,7 @@ bool Controller::IsTextFitEnabled() const
 
 void Controller::SetTextFitMinSize(float minSize, FontSizeType type)
 {
-  switch(type)
-  {
-    case POINT_SIZE:
-    {
-      mImpl->mTextFitMinSize = minSize;
-      break;
-    }
-    case PIXEL_SIZE:
-    {
-      mImpl->mTextFitMinSize = ConvertPixelToPint(minSize);
-      break;
-    }
-  }
+  mImpl->mTextFitMinSize = (type == POINT_SIZE) ? minSize : ConvertPixelToPoint(minSize);
 }
 
 float Controller::GetTextFitMinSize() const
@@ -506,19 +481,7 @@ float Controller::GetTextFitMinSize() const
 
 void Controller::SetTextFitMaxSize(float maxSize, FontSizeType type)
 {
-  switch(type)
-  {
-    case POINT_SIZE:
-    {
-      mImpl->mTextFitMaxSize = maxSize;
-      break;
-    }
-    case PIXEL_SIZE:
-    {
-      mImpl->mTextFitMaxSize = ConvertPixelToPint(maxSize);
-      break;
-    }
-  }
+  mImpl->mTextFitMaxSize = (type == POINT_SIZE) ? maxSize : ConvertPixelToPoint(maxSize);
 }
 
 float Controller::GetTextFitMaxSize() const
@@ -528,19 +491,7 @@ float Controller::GetTextFitMaxSize() const
 
 void Controller::SetTextFitStepSize(float step, FontSizeType type)
 {
-  switch(type)
-  {
-    case POINT_SIZE:
-    {
-      mImpl->mTextFitStepSize = step;
-      break;
-    }
-    case PIXEL_SIZE:
-    {
-      mImpl->mTextFitStepSize = ConvertPixelToPint(step);
-      break;
-    }
-  }
+  mImpl->mTextFitStepSize = (type == POINT_SIZE) ? step : ConvertPixelToPoint(step);
 }
 
 float Controller::GetTextFitStepSize() const
@@ -608,8 +559,6 @@ bool Controller::IsGrabHandlePopupEnabled() const
   return mImpl->mEventData->mGrabHandlePopupEnabled;
 }
 
-// public : Update
-
 void Controller::SetText(const std::string& text)
 {
   TextUpdater::SetText(*this, text);
@@ -678,28 +627,16 @@ void Controller::SendSelectionToClipboard(bool deleteAfterSending)
   mImpl->SendSelectionToClipboard(deleteAfterSending);
 }
 
-// public : Default style & Input style
-
 void Controller::SetDefaultFontFamily(const std::string& defaultFontFamily)
 {
-  if(NULL == mImpl->mFontDefaults)
-  {
-    mImpl->mFontDefaults = new FontDefaults();
-  }
+  EnsureCreated(mImpl->mFontDefaults);
 
   mImpl->mFontDefaults->mFontDescription.family = defaultFontFamily;
   DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::SetDefaultFontFamily %s\n", defaultFontFamily.c_str());
   mImpl->mFontDefaults->familyDefined = !defaultFontFamily.empty();
 
-  if(mImpl->mEventData)
-  {
-    // Update the cursor position if it's in editing mode
-    if(EventData::IsEditingState(mImpl->mEventData->mState))
-    {
-      mImpl->mEventData->mDecoratorUpdated     = true;
-      mImpl->mEventData->mUpdateCursorPosition = true; // Cursor position should be updated when the font family is updated.
-    }
-  }
+  // Update the cursor position if it's in editing mode
+  UpdateCursorPosition(mImpl->mEventData);
 
   // Clear the font-specific data
   ClearFontData();
@@ -709,12 +646,7 @@ void Controller::SetDefaultFontFamily(const std::string& defaultFontFamily)
 
 const std::string& Controller::GetDefaultFontFamily() const
 {
-  if(NULL != mImpl->mFontDefaults)
-  {
-    return mImpl->mFontDefaults->mFontDescription.family;
-  }
-
-  return EMPTY_STRING;
+  return mImpl->mFontDefaults ? mImpl->mFontDefaults->mFontDescription.family : EMPTY_STRING;
 }
 
 void Controller::SetPlaceholderFontFamily(const std::string& placeholderTextFontFamily)
@@ -729,23 +661,13 @@ const std::string& Controller::GetPlaceholderFontFamily() const
 
 void Controller::SetDefaultFontWeight(FontWeight weight)
 {
-  if(NULL == mImpl->mFontDefaults)
-  {
-    mImpl->mFontDefaults = new FontDefaults();
-  }
+  EnsureCreated(mImpl->mFontDefaults);
 
   mImpl->mFontDefaults->mFontDescription.weight = weight;
   mImpl->mFontDefaults->weightDefined           = true;
 
-  if(mImpl->mEventData)
-  {
-    // Update the cursor position if it's in editing mode
-    if(EventData::IsEditingState(mImpl->mEventData->mState))
-    {
-      mImpl->mEventData->mDecoratorUpdated     = true;
-      mImpl->mEventData->mUpdateCursorPosition = true; // Cursor position should be updated when the font weight is updated.
-    }
-  }
+  // Update the cursor position if it's in editing mode
+  UpdateCursorPosition(mImpl->mEventData);
 
   // Clear the font-specific data
   ClearFontData();
@@ -755,22 +677,12 @@ void Controller::SetDefaultFontWeight(FontWeight weight)
 
 bool Controller::IsDefaultFontWeightDefined() const
 {
-  if(NULL != mImpl->mFontDefaults)
-  {
-    return mImpl->mFontDefaults->weightDefined;
-  }
-
-  return false;
+  return mImpl->mFontDefaults && mImpl->mFontDefaults->weightDefined;
 }
 
 FontWeight Controller::GetDefaultFontWeight() const
 {
-  if(NULL != mImpl->mFontDefaults)
-  {
-    return mImpl->mFontDefaults->mFontDescription.weight;
-  }
-
-  return TextAbstraction::FontWeight::NORMAL;
+  return mImpl->mFontDefaults ? mImpl->mFontDefaults->mFontDescription.weight : TextAbstraction::FontWeight::NORMAL;
 }
 
 void Controller::SetPlaceholderTextFontWeight(FontWeight weight)
@@ -781,7 +693,6 @@ void Controller::SetPlaceholderTextFontWeight(FontWeight weight)
 bool Controller::IsPlaceholderTextFontWeightDefined() const
 {
   return PlaceholderHandler::IsPlaceholderTextFontWeightDefined(*this);
-  ;
 }
 
 FontWeight Controller::GetPlaceholderTextFontWeight() const
@@ -791,23 +702,13 @@ FontWeight Controller::GetPlaceholderTextFontWeight() const
 
 void Controller::SetDefaultFontWidth(FontWidth width)
 {
-  if(NULL == mImpl->mFontDefaults)
-  {
-    mImpl->mFontDefaults = new FontDefaults();
-  }
+  EnsureCreated(mImpl->mFontDefaults);
 
   mImpl->mFontDefaults->mFontDescription.width = width;
   mImpl->mFontDefaults->widthDefined           = true;
 
-  if(mImpl->mEventData)
-  {
-    // Update the cursor position if it's in editing mode
-    if(EventData::IsEditingState(mImpl->mEventData->mState))
-    {
-      mImpl->mEventData->mDecoratorUpdated     = true;
-      mImpl->mEventData->mUpdateCursorPosition = true; // Cursor position should be updated when the font width is updated.
-    }
-  }
+  // Update the cursor position if it's in editing mode
+  UpdateCursorPosition(mImpl->mEventData);
 
   // Clear the font-specific data
   ClearFontData();
@@ -817,22 +718,12 @@ void Controller::SetDefaultFontWidth(FontWidth width)
 
 bool Controller::IsDefaultFontWidthDefined() const
 {
-  if(NULL != mImpl->mFontDefaults)
-  {
-    return mImpl->mFontDefaults->widthDefined;
-  }
-
-  return false;
+  return mImpl->mFontDefaults && mImpl->mFontDefaults->widthDefined;
 }
 
 FontWidth Controller::GetDefaultFontWidth() const
 {
-  if(NULL != mImpl->mFontDefaults)
-  {
-    return mImpl->mFontDefaults->mFontDescription.width;
-  }
-
-  return TextAbstraction::FontWidth::NORMAL;
+  return mImpl->mFontDefaults ? mImpl->mFontDefaults->mFontDescription.width : TextAbstraction::FontWidth::NORMAL;
 }
 
 void Controller::SetPlaceholderTextFontWidth(FontWidth width)
@@ -852,23 +743,13 @@ FontWidth Controller::GetPlaceholderTextFontWidth() const
 
 void Controller::SetDefaultFontSlant(FontSlant slant)
 {
-  if(NULL == mImpl->mFontDefaults)
-  {
-    mImpl->mFontDefaults = new FontDefaults();
-  }
+  EnsureCreated(mImpl->mFontDefaults);
 
   mImpl->mFontDefaults->mFontDescription.slant = slant;
   mImpl->mFontDefaults->slantDefined           = true;
 
-  if(mImpl->mEventData)
-  {
-    // Update the cursor position if it's in editing mode
-    if(EventData::IsEditingState(mImpl->mEventData->mState))
-    {
-      mImpl->mEventData->mDecoratorUpdated     = true;
-      mImpl->mEventData->mUpdateCursorPosition = true; // Cursor position should be updated when the font slant is updated.
-    }
-  }
+  // Update the cursor position if it's in editing mode
+  UpdateCursorPosition(mImpl->mEventData);
 
   // Clear the font-specific data
   ClearFontData();
@@ -878,21 +759,12 @@ void Controller::SetDefaultFontSlant(FontSlant slant)
 
 bool Controller::IsDefaultFontSlantDefined() const
 {
-  if(NULL != mImpl->mFontDefaults)
-  {
-    return mImpl->mFontDefaults->slantDefined;
-  }
-  return false;
+  return mImpl->mFontDefaults && mImpl->mFontDefaults->slantDefined;
 }
 
 FontSlant Controller::GetDefaultFontSlant() const
 {
-  if(NULL != mImpl->mFontDefaults)
-  {
-    return mImpl->mFontDefaults->mFontDescription.slant;
-  }
-
-  return TextAbstraction::FontSlant::NORMAL;
+  return mImpl->mFontDefaults ? mImpl->mFontDefaults->mFontDescription.slant : TextAbstraction::FontSlant::NORMAL;
 }
 
 void Controller::SetPlaceholderTextFontSlant(FontSlant slant)
@@ -914,15 +786,8 @@ void Controller::SetFontSizeScale(float scale)
 {
   mImpl->mFontSizeScale = scale;
 
-  if(mImpl->mEventData)
-  {
-    // Update the cursor position if it's in editing mode
-    if(EventData::IsEditingState(mImpl->mEventData->mState))
-    {
-      mImpl->mEventData->mDecoratorUpdated     = true;
-      mImpl->mEventData->mUpdateCursorPosition = true; // Cursor position should be updated when the font size is updated.
-    }
-  }
+  // Update the cursor position if it's in editing mode
+  UpdateCursorPosition(mImpl->mEventData);
 
   // Clear the font-specific data
   ClearFontData();
@@ -932,52 +797,18 @@ void Controller::SetFontSizeScale(float scale)
 
 float Controller::GetFontSizeScale() const
 {
-  if(nullptr != mImpl->mFontDefaults)
-  {
-    return mImpl->mFontSizeScale;
-  }
-
-  return 1.f;
+  return mImpl->mFontDefaults ? mImpl->mFontSizeScale : 1.0f;
 }
 
 void Controller::SetDefaultFontSize(float fontSize, FontSizeType type)
 {
-  if(NULL == mImpl->mFontDefaults)
-  {
-    mImpl->mFontDefaults = new FontDefaults();
-  }
+  EnsureCreated(mImpl->mFontDefaults);
 
-  switch(type)
-  {
-    case POINT_SIZE:
-    {
-      mImpl->mFontDefaults->mDefaultPointSize = fontSize;
-      mImpl->mFontDefaults->sizeDefined       = true;
-      break;
-    }
-    case PIXEL_SIZE:
-    {
-      // Point size = Pixel size * 72.f / DPI
-      unsigned int                horizontalDpi = 0u;
-      unsigned int                verticalDpi   = 0u;
-      TextAbstraction::FontClient fontClient    = TextAbstraction::FontClient::Get();
-      fontClient.GetDpi(horizontalDpi, verticalDpi);
-
-      mImpl->mFontDefaults->mDefaultPointSize = (fontSize * 72.f) / static_cast<float>(horizontalDpi);
-      mImpl->mFontDefaults->sizeDefined       = true;
-      break;
-    }
-  }
+  mImpl->mFontDefaults->mDefaultPointSize = (type == POINT_SIZE) ? fontSize : ConvertPixelToPoint(fontSize);
+  mImpl->mFontDefaults->sizeDefined       = true;
 
-  if(mImpl->mEventData)
-  {
-    // Update the cursor position if it's in editing mode
-    if(EventData::IsEditingState(mImpl->mEventData->mState))
-    {
-      mImpl->mEventData->mDecoratorUpdated     = true;
-      mImpl->mEventData->mUpdateCursorPosition = true; // Cursor position should be updated when the font size is updated.
-    }
-  }
+  // Update the cursor position if it's in editing mode
+  UpdateCursorPosition(mImpl->mEventData);
 
   // Clear the font-specific data
   ClearFontData();
@@ -987,32 +818,11 @@ void Controller::SetDefaultFontSize(float fontSize, FontSizeType type)
 
 float Controller::GetDefaultFontSize(FontSizeType type) const
 {
-  float value = 0.0f;
-  if(NULL != mImpl->mFontDefaults)
+  if(mImpl->mFontDefaults)
   {
-    switch(type)
-    {
-      case POINT_SIZE:
-      {
-        value = mImpl->mFontDefaults->mDefaultPointSize;
-        break;
-      }
-      case PIXEL_SIZE:
-      {
-        // Pixel size = Point size * DPI / 72.f
-        unsigned int                horizontalDpi = 0u;
-        unsigned int                verticalDpi   = 0u;
-        TextAbstraction::FontClient fontClient    = TextAbstraction::FontClient::Get();
-        fontClient.GetDpi(horizontalDpi, verticalDpi);
-
-        value = mImpl->mFontDefaults->mDefaultPointSize * static_cast<float>(horizontalDpi) / 72.f;
-        break;
-      }
-    }
-    return value;
+    return (type == POINT_SIZE) ? mImpl->mFontDefaults->mDefaultPointSize : ConvertPointToPixel(mImpl->mFontDefaults->mDefaultPointSize);
   }
-
-  return value;
+  return 0.0f;
 }
 
 void Controller::SetPlaceholderTextFontSize(float fontSize, FontSizeType type)
@@ -1032,11 +842,8 @@ void Controller::SetDefaultColor(const Vector4& color)
   if(!mImpl->IsShowingPlaceholderText())
   {
     mImpl->mModel->mVisualModel->SetTextColor(color);
-
     mImpl->mModel->mLogicalModel->mColorRuns.Clear();
-
     mImpl->mOperationsPending = static_cast<OperationsMask>(mImpl->mOperationsPending | COLOR);
-
     mImpl->RequestRelayout();
   }
 }
@@ -1059,7 +866,6 @@ const Vector4& Controller::GetPlaceholderTextColor() const
 void Controller::SetShadowOffset(const Vector2& shadowOffset)
 {
   mImpl->mModel->mVisualModel->SetShadowOffset(shadowOffset);
-
   mImpl->RequestRelayout();
 }
 
@@ -1071,7 +877,6 @@ const Vector2& Controller::GetShadowOffset() const
 void Controller::SetShadowColor(const Vector4& shadowColor)
 {
   mImpl->mModel->mVisualModel->SetShadowColor(shadowColor);
-
   mImpl->RequestRelayout();
 }
 
@@ -1085,7 +890,6 @@ void Controller::SetShadowBlurRadius(const float& shadowBlurRadius)
   if(fabsf(GetShadowBlurRadius() - shadowBlurRadius) > Math::MACHINE_EPSILON_1)
   {
     mImpl->mModel->mVisualModel->SetShadowBlurRadius(shadowBlurRadius);
-
     mImpl->RequestRelayout();
   }
 }
@@ -1098,7 +902,6 @@ const float& Controller::GetShadowBlurRadius() const
 void Controller::SetUnderlineColor(const Vector4& color)
 {
   mImpl->mModel->mVisualModel->SetUnderlineColor(color);
-
   mImpl->RequestRelayout();
 }
 
@@ -1110,7 +913,6 @@ const Vector4& Controller::GetUnderlineColor() const
 void Controller::SetUnderlineEnabled(bool enabled)
 {
   mImpl->mModel->mVisualModel->SetUnderlineEnabled(enabled);
-
   mImpl->RequestRelayout();
 }
 
@@ -1122,7 +924,6 @@ bool Controller::IsUnderlineEnabled() const
 void Controller::SetUnderlineHeight(float height)
 {
   mImpl->mModel->mVisualModel->SetUnderlineHeight(height);
-
   mImpl->RequestRelayout();
 }
 
@@ -1134,7 +935,6 @@ float Controller::GetUnderlineHeight() const
 void Controller::SetOutlineColor(const Vector4& color)
 {
   mImpl->mModel->mVisualModel->SetOutlineColor(color);
-
   mImpl->RequestRelayout();
 }
 
@@ -1146,7 +946,6 @@ const Vector4& Controller::GetOutlineColor() const
 void Controller::SetOutlineWidth(uint16_t width)
 {
   mImpl->mModel->mVisualModel->SetOutlineWidth(width);
-
   mImpl->RequestRelayout();
 }
 
@@ -1158,7 +957,6 @@ uint16_t Controller::GetOutlineWidth() const
 void Controller::SetBackgroundColor(const Vector4& color)
 {
   mImpl->mModel->mVisualModel->SetBackgroundColor(color);
-
   mImpl->RequestRelayout();
 }
 
@@ -1170,7 +968,6 @@ const Vector4& Controller::GetBackgroundColor() const
 void Controller::SetBackgroundEnabled(bool enabled)
 {
   mImpl->mModel->mVisualModel->SetBackgroundEnabled(enabled);
-
   mImpl->RequestRelayout();
 }
 
@@ -1181,42 +978,24 @@ bool Controller::IsBackgroundEnabled() const
 
 void Controller::SetDefaultEmbossProperties(const std::string& embossProperties)
 {
-  if(NULL == mImpl->mEmbossDefaults)
-  {
-    mImpl->mEmbossDefaults = new EmbossDefaults();
-  }
-
+  EnsureCreated(mImpl->mEmbossDefaults);
   mImpl->mEmbossDefaults->properties = embossProperties;
 }
 
 const std::string& Controller::GetDefaultEmbossProperties() const
 {
-  if(NULL != mImpl->mEmbossDefaults)
-  {
-    return mImpl->mEmbossDefaults->properties;
-  }
-
-  return EMPTY_STRING;
+  return mImpl->mEmbossDefaults ? mImpl->mEmbossDefaults->properties : EMPTY_STRING;
 }
 
 void Controller::SetDefaultOutlineProperties(const std::string& outlineProperties)
 {
-  if(NULL == mImpl->mOutlineDefaults)
-  {
-    mImpl->mOutlineDefaults = new OutlineDefaults();
-  }
-
+  EnsureCreated(mImpl->mOutlineDefaults);
   mImpl->mOutlineDefaults->properties = outlineProperties;
 }
 
 const std::string& Controller::GetDefaultOutlineProperties() const
 {
-  if(NULL != mImpl->mOutlineDefaults)
-  {
-    return mImpl->mOutlineDefaults->properties;
-  }
-
-  return EMPTY_STRING;
+  return mImpl->mOutlineDefaults ? mImpl->mOutlineDefaults->properties : EMPTY_STRING;
 }
 
 void Controller::RelayoutForNewLineSize()
@@ -1228,7 +1007,7 @@ void Controller::RelayoutForNewLineSize()
   mImpl->mOperationsPending                          = static_cast<OperationsMask>(mImpl->mOperationsPending | LAYOUT);
 
   //remove selection
-  if((mImpl->mEventData != nullptr) && (mImpl->mEventData->mState == EventData::SELECTING))
+  if(mImpl->mEventData && mImpl->mEventData->mState == EventData::SELECTING)
   {
     mImpl->ChangeState(EventData::EDITING);
   }
@@ -1274,7 +1053,7 @@ float Controller::GetDefaultLineSize() const
 
 void Controller::SetInputColor(const Vector4& color)
 {
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     mImpl->mEventData->mInputStyle.textColor      = color;
     mImpl->mEventData->mInputStyle.isDefaultColor = false;
@@ -1318,13 +1097,8 @@ void Controller::SetInputColor(const Vector4& color)
 
 const Vector4& Controller::GetInputColor() const
 {
-  if(NULL != mImpl->mEventData)
-  {
-    return mImpl->mEventData->mInputStyle.textColor;
-  }
-
-  // Return the default text's color if there is no EventData.
-  return mImpl->mTextColor;
+  // Return event text input color if we have it, otherwise just return the default text's color
+  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.textColor : mImpl->mTextColor;
 }
 
 void Controller::SetInputFontFamily(const std::string& fontFamily)
@@ -1394,7 +1168,7 @@ float Controller::GetInputFontPointSize() const
 
 void Controller::SetInputLineSpacing(float lineSpacing)
 {
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     mImpl->mEventData->mInputStyle.lineSpacing          = lineSpacing;
     mImpl->mEventData->mInputStyle.isLineSpacingDefined = true;
@@ -1403,17 +1177,12 @@ void Controller::SetInputLineSpacing(float lineSpacing)
 
 float Controller::GetInputLineSpacing() const
 {
-  if(NULL != mImpl->mEventData)
-  {
-    return mImpl->mEventData->mInputStyle.lineSpacing;
-  }
-
-  return 0.f;
+  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.lineSpacing : 0.0f;
 }
 
 void Controller::SetInputShadowProperties(const std::string& shadowProperties)
 {
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     mImpl->mEventData->mInputStyle.shadowProperties = shadowProperties;
   }
@@ -1421,17 +1190,12 @@ void Controller::SetInputShadowProperties(const std::string& shadowProperties)
 
 const std::string& Controller::GetInputShadowProperties() const
 {
-  if(NULL != mImpl->mEventData)
-  {
-    return mImpl->mEventData->mInputStyle.shadowProperties;
-  }
-
-  return EMPTY_STRING;
+  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.shadowProperties : EMPTY_STRING;
 }
 
 void Controller::SetInputUnderlineProperties(const std::string& underlineProperties)
 {
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     mImpl->mEventData->mInputStyle.underlineProperties = underlineProperties;
   }
@@ -1439,17 +1203,12 @@ void Controller::SetInputUnderlineProperties(const std::string& underlinePropert
 
 const std::string& Controller::GetInputUnderlineProperties() const
 {
-  if(NULL != mImpl->mEventData)
-  {
-    return mImpl->mEventData->mInputStyle.underlineProperties;
-  }
-
-  return EMPTY_STRING;
+  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.underlineProperties : EMPTY_STRING;
 }
 
 void Controller::SetInputEmbossProperties(const std::string& embossProperties)
 {
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     mImpl->mEventData->mInputStyle.embossProperties = embossProperties;
   }
@@ -1457,17 +1216,12 @@ void Controller::SetInputEmbossProperties(const std::string& embossProperties)
 
 const std::string& Controller::GetInputEmbossProperties() const
 {
-  if(NULL != mImpl->mEventData)
-  {
-    return mImpl->mEventData->mInputStyle.embossProperties;
-  }
-
-  return GetDefaultEmbossProperties();
+  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.embossProperties : GetDefaultEmbossProperties();
 }
 
 void Controller::SetInputOutlineProperties(const std::string& outlineProperties)
 {
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     mImpl->mEventData->mInputStyle.outlineProperties = outlineProperties;
   }
@@ -1475,17 +1229,12 @@ void Controller::SetInputOutlineProperties(const std::string& outlineProperties)
 
 const std::string& Controller::GetInputOutlineProperties() const
 {
-  if(NULL != mImpl->mEventData)
-  {
-    return mImpl->mEventData->mInputStyle.outlineProperties;
-  }
-
-  return GetDefaultOutlineProperties();
+  return mImpl->mEventData ? mImpl->mEventData->mInputStyle.outlineProperties : GetDefaultOutlineProperties();
 }
 
 void Controller::SetInputModePassword(bool passwordInput)
 {
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     mImpl->mEventData->mPasswordInput = passwordInput;
   }
@@ -1493,16 +1242,12 @@ void Controller::SetInputModePassword(bool passwordInput)
 
 bool Controller::IsInputModePassword()
 {
-  if(NULL != mImpl->mEventData)
-  {
-    return mImpl->mEventData->mPasswordInput;
-  }
-  return false;
+  return mImpl->mEventData && mImpl->mEventData->mPasswordInput;
 }
 
 void Controller::SetNoTextDoubleTapAction(NoTextTap::Action action)
 {
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     mImpl->mEventData->mDoubleTapAction = action;
   }
@@ -1510,19 +1255,12 @@ void Controller::SetNoTextDoubleTapAction(NoTextTap::Action action)
 
 Controller::NoTextTap::Action Controller::GetNoTextDoubleTapAction() const
 {
-  NoTextTap::Action action = NoTextTap::NO_ACTION;
-
-  if(NULL != mImpl->mEventData)
-  {
-    action = mImpl->mEventData->mDoubleTapAction;
-  }
-
-  return action;
+  return mImpl->mEventData ? mImpl->mEventData->mDoubleTapAction : NoTextTap::NO_ACTION;
 }
 
 void Controller::SetNoTextLongPressAction(NoTextTap::Action action)
 {
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     mImpl->mEventData->mLongPressAction = action;
   }
@@ -1530,14 +1268,7 @@ void Controller::SetNoTextLongPressAction(NoTextTap::Action action)
 
 Controller::NoTextTap::Action Controller::GetNoTextLongPressAction() const
 {
-  NoTextTap::Action action = NoTextTap::NO_ACTION;
-
-  if(NULL != mImpl->mEventData)
-  {
-    action = mImpl->mEventData->mLongPressAction;
-  }
-
-  return action;
+  return mImpl->mEventData ? mImpl->mEventData->mLongPressAction : NoTextTap::NO_ACTION;
 }
 
 bool Controller::IsUnderlineSetByString()
@@ -1580,8 +1311,6 @@ void Controller::FontStyleSetByString(bool setByString)
   mImpl->mFontStyleSetByString = setByString;
 }
 
-// public : Queries & retrieves.
-
 Layout::Engine& Controller::GetLayoutEngine()
 {
   return mImpl->mLayoutEngine;
@@ -1615,8 +1344,7 @@ float Controller::GetHeightForWidth(float width)
 int Controller::GetLineCount(float width)
 {
   GetHeightForWidth(width);
-  int numberofLines = mImpl->mModel->GetNumberOfLines();
-  return numberofLines;
+  return mImpl->mModel->GetNumberOfLines();
 }
 
 const ModelInterface* const Controller::GetTextModel() const
@@ -1650,16 +1378,13 @@ bool Controller::GetTextScrollInfo(float& scrollPosition, float& controlHeight,
 
 void Controller::SetHiddenInputOption(const Property::Map& options)
 {
-  if(NULL == mImpl->mHiddenInput)
-  {
-    mImpl->mHiddenInput = new HiddenText(this);
-  }
+  EnsureCreated<HiddenText, Controller*>(mImpl->mHiddenInput, this);
   mImpl->mHiddenInput->SetProperties(options);
 }
 
 void Controller::GetHiddenInputOption(Property::Map& options)
 {
-  if(NULL != mImpl->mHiddenInput)
+  if(mImpl->mHiddenInput)
   {
     mImpl->mHiddenInput->GetProperties(options);
   }
@@ -1667,16 +1392,13 @@ void Controller::GetHiddenInputOption(Property::Map& options)
 
 void Controller::SetInputFilterOption(const Property::Map& options)
 {
-  if(!mImpl->mInputFilter)
-  {
-    mImpl->mInputFilter = std::unique_ptr<InputFilter>(new InputFilter());
-  }
+  EnsureCreated(mImpl->mInputFilter);
   mImpl->mInputFilter->SetProperties(options);
 }
 
 void Controller::GetInputFilterOption(Property::Map& options)
 {
-  if(NULL != mImpl->mInputFilter)
+  if(mImpl->mInputFilter)
   {
     mImpl->mInputFilter->GetProperties(options);
   }
@@ -1757,8 +1479,6 @@ void Controller::SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type
   mImpl->mModel->mVisualModel->SetEllipsisPosition(ellipsisPosition);
 }
 
-// public : Relayout.
-
 Controller::UpdateTextType Controller::Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection)
 {
   return Relayouter::Relayout(*this, size, layoutDirection);
@@ -1769,8 +1489,6 @@ void Controller::RequestRelayout()
   mImpl->RequestRelayout();
 }
 
-// public : Input style change signals.
-
 bool Controller::IsInputStyleChangedSignalsQueueEmpty()
 {
   return (NULL == mImpl->mEventData) || (0u == mImpl->mEventData->mInputStyleChangedQueue.Count());
@@ -1778,31 +1496,20 @@ bool Controller::IsInputStyleChangedSignalsQueueEmpty()
 
 void Controller::ProcessInputStyleChangedSignals()
 {
-  if(NULL == mImpl->mEventData)
-  {
-    // Nothing to do.
-    return;
-  }
-
-  for(Vector<InputStyle::Mask>::ConstIterator it    = mImpl->mEventData->mInputStyleChangedQueue.Begin(),
-                                              endIt = mImpl->mEventData->mInputStyleChangedQueue.End();
-      it != endIt;
-      ++it)
+  if(mImpl->mEventData)
   {
-    const InputStyle::Mask mask = *it;
-
-    if(NULL != mImpl->mEditableControlInterface)
+    if(mImpl->mEditableControlInterface)
     {
-      // Emit the input style changed signal.
-      mImpl->mEditableControlInterface->InputStyleChanged(mask);
+      // Emit the input style changed signal for each mask
+      std::for_each(mImpl->mEventData->mInputStyleChangedQueue.begin(),
+                    mImpl->mEventData->mInputStyleChangedQueue.end(),
+                    [&](const auto mask) { mImpl->mEditableControlInterface->InputStyleChanged(mask); } );
     }
-  }
 
-  mImpl->mEventData->mInputStyleChangedQueue.Clear();
+    mImpl->mEventData->mInputStyleChangedQueue.Clear();
+  }
 }
 
-// public : Text-input Event Queuing.
-
 void Controller::KeyboardFocusGainEvent()
 {
   EventHandler::KeyboardFocusGainEvent(*this);
@@ -1933,7 +1640,7 @@ string Controller::CutText()
 
   if(!IsEditable())
   {
-    return "";
+    return EMPTY_STRING;
   }
 
   mImpl->SendSelectionToClipboard(true); // Synchronous call to modify text
@@ -1976,8 +1683,6 @@ void Controller::PasteClipboardItemEvent()
   EventHandler::PasteClipboardItemEvent(*this);
 }
 
-// protected : Inherit from Text::Decorator::ControllerInterface.
-
 void Controller::GetTargetSize(Vector2& targetSize)
 {
   targetSize = mImpl->mModel->mVisualModel->mControlSize;
@@ -1985,7 +1690,7 @@ void Controller::GetTargetSize(Vector2& targetSize)
 
 void Controller::AddDecoration(Actor& actor, bool needsClipping)
 {
-  if(NULL != mImpl->mEditableControlInterface)
+  if(mImpl->mEditableControlInterface)
   {
     mImpl->mEditableControlInterface->AddDecoration(actor, needsClipping);
   }
@@ -2037,22 +1742,14 @@ void Controller::ScrollBy(Vector2 scroll)
 
 float Controller::GetHorizontalScrollPosition()
 {
-  if(mImpl->mEventData)
-  {
-    //scroll values are negative internally so we convert them to positive numbers
-    return -mImpl->mModel->mScrollPosition.x;
-  }
-  return 0;
+  // Scroll values are negative internally so we convert them to positive numbers
+  return mImpl->mEventData ? -mImpl->mModel->mScrollPosition.x : 0.0f;
 }
 
 float Controller::GetVerticalScrollPosition()
 {
-  if(mImpl->mEventData)
-  {
-    //scroll values are negative internally so we convert them to positive numbers
-    return -mImpl->mModel->mScrollPosition.y;
-  }
-  return 0;
+  // Scroll values are negative internally so we convert them to positive numbers
+  return mImpl->mEventData ? -mImpl->mModel->mScrollPosition.y : 0.0f;
 }
 
 void Controller::DecorationEvent(HandleType handleType, HandleState state, float x, float y)
@@ -2060,8 +1757,6 @@ void Controller::DecorationEvent(HandleType handleType, HandleState state, float
   EventHandler::DecorationEvent(*this, handleType, state, x, y);
 }
 
-// protected : Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
-
 void Controller::TextPopupButtonTouched(Dali::Toolkit::TextSelectionPopup::Buttons button)
 {
   EventHandler::TextPopupButtonTouched(*this, button);
@@ -2076,8 +1771,6 @@ void Controller::DisplayTimeExpired()
   mImpl->RequestRelayout();
 }
 
-// private : Update.
-
 void Controller::InsertText(const std::string& text, Controller::InsertType type)
 {
   TextUpdater::InsertText(*this, text, type);
@@ -2088,9 +1781,7 @@ void Controller::PasteText(const std::string& stringToPaste)
   TextUpdater::PasteText(*this, stringToPaste);
 }
 
-bool Controller::RemoveText(int                  cursorOffset,
-                            int                  numberOfCharacters,
-                            UpdateInputStyleType type)
+bool Controller::RemoveText(int cursorOffset, int numberOfCharacters, UpdateInputStyleType type)
 {
   return TextUpdater::RemoveText(*this, cursorOffset, numberOfCharacters, type);
 }
@@ -2100,24 +1791,17 @@ bool Controller::RemoveSelectedText()
   return TextUpdater::RemoveSelectedText(*this);
 }
 
-void Controller::InsertTextAnchor(int            numberOfCharacters,
-                                  CharacterIndex previousCursorIndex)
+void Controller::InsertTextAnchor(int numberOfCharacters, CharacterIndex previousCursorIndex)
 {
   TextUpdater::InsertTextAnchor(*this, numberOfCharacters, previousCursorIndex);
 }
 
-void Controller::RemoveTextAnchor(int            cursorOffset,
-                                  int            numberOfCharacters,
-                                  CharacterIndex previousCursorIndex)
+void Controller::RemoveTextAnchor(int cursorOffset, int numberOfCharacters, CharacterIndex previousCursorIndex)
 {
   TextUpdater::RemoveTextAnchor(*this, cursorOffset, numberOfCharacters, previousCursorIndex);
 }
 
-// private : Relayout.
-
-bool Controller::DoRelayout(const Size&    size,
-                            OperationsMask operationsRequired,
-                            Size&          layoutSize)
+bool Controller::DoRelayout(const Size& size, OperationsMask operationsRequired, Size& layoutSize)
 {
   return Relayouter::DoRelayout(*this, size, operationsRequired, layoutSize);
 }
@@ -2127,8 +1811,6 @@ void Controller::CalculateVerticalOffset(const Size& controlSize)
   Relayouter::CalculateVerticalOffset(*this, controlSize);
 }
 
-// private : Events.
-
 void Controller::ProcessModifyEvents()
 {
   EventHandler::ProcessModifyEvents(*this);
@@ -2224,7 +1906,7 @@ CharacterIndex Controller::GetCursorPosition()
 
 void Controller::ResetScrollPosition()
 {
-  if(NULL != mImpl->mEventData)
+  if(mImpl->mEventData)
   {
     // Reset the scroll position.
     mImpl->mModel->mScrollPosition                = Vector2::ZERO;
@@ -2252,18 +1934,6 @@ Actor Controller::CreateBackgroundActor()
   return mImpl->CreateBackgroundActor();
 }
 
-// private : Private contructors & copy operator.
-
-Controller::Controller()
-: Controller(nullptr, nullptr, nullptr, nullptr)
-{
-}
-
-Controller::Controller(ControlInterface* controlInterface)
-: Controller(controlInterface, nullptr, nullptr, nullptr)
-{
-}
-
 Controller::Controller(ControlInterface*           controlInterface,
                        EditableControlInterface*   editableControlInterface,
                        SelectableControlInterface* selectableControlInterface,
@@ -2272,17 +1942,9 @@ Controller::Controller(ControlInterface*           controlInterface,
 {
 }
 
-// The copy constructor and operator are left unimplemented.
-
-// protected : Destructor.
-
 Controller::~Controller()
 {
   delete mImpl;
 }
 
-} // namespace Text
-
-} // namespace Toolkit
-
-} // namespace Dali
+} // namespace Dali::Toolkit::Text
index 9302cf5..3240384 100644 (file)
 #include <dali-toolkit/internal/text/text-selectable-control-interface.h>
 #include <dali-toolkit/public-api/text/text-enumerations.h>
 
-namespace Dali
-{
-namespace Toolkit
-{
-namespace Text
+namespace Dali::Toolkit::Text
 {
 class Controller;
 class ControlInterface;
@@ -170,7 +166,10 @@ public: // Constructor.
    *
    * @return A pointer to a new Controller.
    */
-  static ControllerPtr New();
+  static ControllerPtr New()
+  {
+    return ControllerPtr(new Controller());
+  }
 
   /**
    * @brief Create a new instance of a Controller.
@@ -179,7 +178,10 @@ public: // Constructor.
    *
    * @return A pointer to a new Controller.
    */
-  static ControllerPtr New(ControlInterface* controlInterface);
+  static ControllerPtr New(ControlInterface* controlInterface)
+  {
+    return ControllerPtr(new Controller(controlInterface));
+  }
 
   /**
    * @brief Create a new instance of a Controller.
@@ -194,7 +196,13 @@ public: // Constructor.
   static ControllerPtr New(ControlInterface*           controlInterface,
                            EditableControlInterface*   editableControlInterface,
                            SelectableControlInterface* selectableControlInterface,
-                           AnchorControlInterface*     anchorControlInterface);
+                           AnchorControlInterface*     anchorControlInterface)
+  {
+    return ControllerPtr(new Controller(controlInterface,
+                                        editableControlInterface,
+                                        selectableControlInterface,
+                                        anchorControlInterface));
+  }
 
 public: // Configure the text controller.
   /**
@@ -1897,12 +1905,18 @@ private: // Private contructors & copy operator.
   /**
    * @brief Private constructor.
    */
-  Controller();
+  Controller()
+  : Controller(nullptr, nullptr, nullptr, nullptr)
+  {
+  }
 
   /**
    * @brief Private constructor.
    */
-  Controller(ControlInterface* controlInterface);
+  Controller(ControlInterface* controlInterface)
+  : Controller(controlInterface, nullptr, nullptr, nullptr)
+  {
+  }
 
   /**
    * @brief Private constructor.
@@ -1912,11 +1926,8 @@ private: // Private contructors & copy operator.
              SelectableControlInterface* selectableControlInterface,
              AnchorControlInterface*     anchorControlInterface);
 
-  // Undefined
-  Controller(const Controller& handle);
-
-  // Undefined
-  Controller& operator=(const Controller& handle);
+  Controller(const Controller& handle) = delete;
+  Controller& operator=(const Controller& handle) = delete;
 
 protected: // Destructor.
   /**
@@ -1937,10 +1948,6 @@ private:
   Impl* mImpl;
 };
 
-} // namespace Text
-
-} // namespace Toolkit
-
-} // namespace Dali
+} // namespace Dali::Toolkit::Text
 
 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H
index 2cbd14d..78ba8db 100644 (file)
@@ -27,6 +27,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
 
 namespace Dali
 {
@@ -37,10 +38,9 @@ namespace Internal
 namespace
 {
 const Dali::AlphaFunction DEFAULT_ALPHA_FUNCTION(Dali::AlphaFunction::DEFAULT);
-
 } // anonymous namespace
 
-TransitionPtr Transition::New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, TimePeriod timePeriod)
+TransitionPtr Transition::New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, bool useDestinationTarget, TimePeriod timePeriod)
 {
   float delaySeconds = timePeriod.delaySeconds;
   if(delaySeconds < 0.0f)
@@ -56,7 +56,7 @@ TransitionPtr Transition::New(Dali::Toolkit::Control source, Dali::Toolkit::Cont
     durationSeconds = 0.0f;
   }
 
-  TransitionPtr transition = new Transition(source, destination, TimePeriod(delaySeconds, durationSeconds));
+  TransitionPtr transition = new Transition(source, destination, useDestinationTarget, TimePeriod(delaySeconds, durationSeconds));
 
   // Second-phase construction
   transition->Initialize();
@@ -64,12 +64,14 @@ TransitionPtr Transition::New(Dali::Toolkit::Control source, Dali::Toolkit::Cont
   return transition;
 }
 
-Transition::Transition(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, TimePeriod timePeriod)
+Transition::Transition(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, bool useDestinationTarget, TimePeriod timePeriod)
 : TransitionBase(),
+  mUseDestinationTarget(useDestinationTarget),
+  mOriginalSize(),
   mSourceControl(source),
   mDestinationControl(destination)
 {
-  SetTarget(destination);
+  SetTarget(mUseDestinationTarget ? destination : source);
   SetTimePeriod(timePeriod);
   SetPairTransition(true);
 }
@@ -90,16 +92,15 @@ void Transition::OnPlay()
   }
 
   //Make startPropertyMap and finishPropertyMap to use for property animation.
-  Matrix     sourceWorldTransform = sourceControl[Dali::Actor::Property::WORLD_MATRIX];
+  Matrix     sourceWorldTransform = GetWorldTransform(sourceControl);
   Vector3    sourcePosition, sourceScale;
   Quaternion sourceOrientation;
   sourceWorldTransform.GetTransformComponents(sourcePosition, sourceOrientation, sourceScale);
 
-  Vector3    destinationPosition    = destinationControl[Dali::Actor::Property::POSITION];
-  Vector3    destinationScale       = destinationControl[Dali::Actor::Property::SCALE];
-  Quaternion destinationOrientation = destinationControl[Dali::Actor::Property::ORIENTATION];
-  Vector4    targetColor            = destinationControl[Dali::Actor::Property::COLOR];
-  Vector3    targetSize             = destinationControl[Dali::Actor::Property::SIZE];
+  Matrix     destinationWorldTransform = GetWorldTransform(destinationControl);
+  Vector3    destinationPosition, destinationScale;
+  Quaternion destinationOrientation;
+  destinationWorldTransform.GetTransformComponents(destinationPosition, destinationOrientation, destinationScale);
 
   Property::Map startPropertyMap;
   Property::Map finishPropertyMap;
@@ -114,29 +115,36 @@ void Transition::OnPlay()
   startPropertyMap.Insert(Dali::Actor::Property::SCALE, sourceScale);
   finishPropertyMap.Insert(Dali::Actor::Property::SCALE, destinationScale);
 
-  Vector4 sourceColor = sourceControl.GetCurrentProperty<Vector4>(Dali::Actor::Property::WORLD_COLOR);
+  Vector4 sourceColor      = GetWorldColor(sourceControl);
+  Vector4 destinationColor = GetWorldColor(destinationControl);
   startPropertyMap.Insert(Dali::Actor::Property::COLOR, sourceColor);
-  finishPropertyMap.Insert(Dali::Actor::Property::COLOR, targetColor);
+  finishPropertyMap.Insert(Dali::Actor::Property::COLOR, destinationColor);
 
   // Set animation for other properties if source and destination is different.
-  Vector3 sourceSize = sourceControl.GetCurrentProperty<Vector3>(Dali::Actor::Property::SIZE);
-  if(sourceSize != targetSize)
+  Vector3 sourceSize      = sourceControl[Dali::Actor::Property::SIZE];
+  Vector3 destinationSize = destinationControl[Dali::Actor::Property::SIZE];
+  if(sourceSize != destinationSize)
   {
     startPropertyMap.Insert(Dali::Actor::Property::SIZE, sourceSize);
-    finishPropertyMap.Insert(Dali::Actor::Property::SIZE, targetSize);
+    finishPropertyMap.Insert(Dali::Actor::Property::SIZE, destinationSize);
+    if(!mUseDestinationTarget)
+    {
+      mOriginalSize = GetTargetControl().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+    }
   }
 
   SetStartPropertyMap(startPropertyMap);
   SetFinishPropertyMap(finishPropertyMap);
 
   // source View becomes transparent during transition.
+  Dali::Toolkit::Control waitingControl = GetWaitingControl();
   if(IsTransitionWithChild())
   {
-    sourceControl[Dali::Actor::Property::VISIBLE] = false;
+    waitingControl[Dali::Actor::Property::VISIBLE] = false;
   }
   else
   {
-    GetImplementation(sourceControl).SetTransparent(true);
+    GetImplementation(waitingControl).SetTransparent(true);
   }
 
   Dali::Animation animation = GetAnimation();
@@ -145,27 +153,82 @@ void Transition::OnPlay()
     DALI_LOG_ERROR("animation is still not initialized\n");
     return;
   }
-  Dali::Toolkit::DevelControl::CreateTransitions(destinationControl, animation, sourceControl, GetAlphaFunction(), GetTimePeriod());
+
+  mOriginalVisualProperties.clear();
+  std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>> destinationVisualProperties;
+  Dali::Toolkit::Control                                             targetControl   = GetTargetControl();
+  Internal::Control&                                                 internalControl = Toolkit::Internal::GetImplementation(targetControl);
+  Internal::Control::Impl&                                           controlDataImpl = Toolkit::Internal::Control::Impl::Get(internalControl);
+  controlDataImpl.CreateTransitions(mOriginalVisualProperties, destinationVisualProperties, sourceControl, destinationControl);
+
+  for(uint32_t index = 0; index < mOriginalVisualProperties.size(); ++index)
+  {
+    Dali::Property::Map source      = mOriginalVisualProperties[index].second;
+    Dali::Property::Map destination = destinationVisualProperties[index].second;
+    for(size_t i = 0; i < source.Count(); ++i)
+    {
+      Dali::Property property = DevelControl::GetVisualProperty(targetControl, mOriginalVisualProperties[index].first, source.GetKeyAt(i));
+      if(GetTimePeriod().delaySeconds > 0.0f)
+      {
+        Dali::KeyFrames initialKeyframes = Dali::KeyFrames::New();
+        initialKeyframes.Add(0.0f, source.GetValue(i));
+        animation.AnimateBetween(property, initialKeyframes, TimePeriod(GetTimePeriod().delaySeconds));
+      }
+      Dali::KeyFrames keyframes = Dali::KeyFrames::New();
+      keyframes.Add(0.0f, source.GetValue(i));
+      keyframes.Add(1.0f, destination.GetValue(i));
+      animation.AnimateBetween(property, keyframes, GetAlphaFunction(), GetTimePeriod());
+    }
+  }
 }
 
 void Transition::OnFinished()
 {
-  Dali::Toolkit::Control sourceControl = mSourceControl.GetHandle();
-  if(!sourceControl)
+  Dali::Toolkit::Control waitingControl = GetWaitingControl();
+  if(!waitingControl)
   {
     return;
   }
 
+  if(!mUseDestinationTarget)
+  {
+    Dali::Toolkit::Control target         = GetTargetControl();
+    Dali::Animation        resetAnimation = Dali::Animation::New(0.0f);
+    if(mOriginalSize != target.GetProperty<Vector3>(Dali::Actor::Property::SIZE))
+    {
+      // Use Animation not to notify size change and not to change width and height resize policy.
+      resetAnimation.AnimateTo(Dali::Property(target, Dali::Actor::Property::SIZE), mOriginalSize);
+    }
+    resetAnimation.Play();
+
+    Dali::Toolkit::Control   targetControl   = GetTargetControl();
+    Internal::Control&       internalControl = Toolkit::Internal::GetImplementation(targetControl);
+    Internal::Control::Impl& controlDataImpl = Toolkit::Internal::Control::Impl::Get(internalControl);
+    controlDataImpl.UpdateVisualProperties(mOriginalVisualProperties);
+  }
+
   if(IsTransitionWithChild())
   {
-    sourceControl[Dali::Actor::Property::VISIBLE] = true;
+    waitingControl[Dali::Actor::Property::VISIBLE] = true;
   }
   else
   {
-    GetImplementation(sourceControl).SetTransparent(false);
+    GetImplementation(waitingControl).SetTransparent(false);
   }
 }
 
+Dali::Toolkit::Control Transition::GetTargetControl()
+{
+  Dali::Toolkit::Control target = mUseDestinationTarget ? mDestinationControl.GetHandle() : mSourceControl.GetHandle();
+  return target;
+}
+
+Dali::Toolkit::Control Transition::GetWaitingControl()
+{
+  Dali::Toolkit::Control waitingControl = mUseDestinationTarget ? mSourceControl.GetHandle() : mDestinationControl.GetHandle();
+  return waitingControl;
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
index 6aa1374..7230e2b 100644 (file)
@@ -41,10 +41,11 @@ public:
    * @brief Create a new Transition object.
    * @param[in] source A source control of this transition.
    * @param[in] destination A destination control of this transition.
+   * @param[in] useDestinationTarget True if this transition uses destination control as target.
    * @param[in] timePeriod The timePeriod of the animation.
    * @return A smart-pointer to the newly allocated Transition.
    */
-  static TransitionPtr New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, TimePeriod timePeriod);
+  static TransitionPtr New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, bool useDestinationTarget, TimePeriod timePeriod);
 
 protected:
   /**
@@ -63,6 +64,7 @@ protected:
    */
   Transition(Dali::Toolkit::Control source,
              Dali::Toolkit::Control destination,
+             bool                   useDestinationTarget,
              TimePeriod             timePeriod);
 
   /**
@@ -78,8 +80,15 @@ private:
   Transition& operator=(const Transition& rhs);
 
 private:
-  WeakHandle<Dali::Toolkit::Control> mSourceControl;
-  WeakHandle<Dali::Toolkit::Control> mDestinationControl;
+  Dali::Toolkit::Control GetTargetControl();
+  Dali::Toolkit::Control GetWaitingControl();
+
+private:
+  bool                                                               mUseDestinationTarget;
+  Vector3                                                            mOriginalSize;
+  std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>> mOriginalVisualProperties;
+  WeakHandle<Dali::Toolkit::Control>                                 mSourceControl;
+  WeakHandle<Dali::Toolkit::Control>                                 mDestinationControl;
 };
 
 } // namespace Internal
index f155b86..f0a7af4 100644 (file)
@@ -295,6 +295,11 @@ void Visual::Base::SetProperties(const Property::Map& propertyMap)
         {
           mImpl->mBorderlineWidth = width;
         }
+
+        if(mImpl->mBorderlineWidthIndex != Property::INVALID_INDEX)
+        {
+          mImpl->mRenderer.SetProperty(mImpl->mBorderlineWidthIndex, mImpl->mBorderlineWidth);
+        }
         break;
       }
       case Toolkit::DevelVisual::Property::BORDERLINE_COLOR:
@@ -304,6 +309,11 @@ void Visual::Base::SetProperties(const Property::Map& propertyMap)
         {
           mImpl->mBorderlineColor = color;
         }
+
+        if(mImpl->mBorderlineColorIndex != Property::INVALID_INDEX)
+        {
+          mImpl->mRenderer.SetProperty(mImpl->mBorderlineColorIndex, mImpl->mBorderlineColor);
+        }
         break;
       }
       case Toolkit::DevelVisual::Property::BORDERLINE_OFFSET:
@@ -313,6 +323,11 @@ void Visual::Base::SetProperties(const Property::Map& propertyMap)
         {
           mImpl->mBorderlineOffset = offset;
         }
+
+        if(mImpl->mBorderlineOffsetIndex != Property::INVALID_INDEX)
+        {
+          mImpl->mRenderer.SetProperty(mImpl->mBorderlineOffsetIndex, mImpl->mBorderlineOffset);
+        }
         break;
       }
       case Toolkit::DevelVisual::Property::CORNER_RADIUS:
@@ -338,6 +353,11 @@ void Visual::Base::SetProperties(const Property::Map& propertyMap)
             mImpl->mCornerRadius = Vector4(radius, radius, radius, radius);
           }
         }
+
+        if(mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
+        {
+          mImpl->mRenderer.SetProperty(mImpl->mCornerRadiusIndex, mImpl->mCornerRadius);
+        }
         break;
       }
       case Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY:
index 548e45e..64745d0 100644 (file)
@@ -702,6 +702,102 @@ void Control::SignalDisconnected(SlotObserver* slotObserver, CallbackBase* callb
   mImpl->SignalDisconnected(slotObserver, callback);
 }
 
+void Control::MakeVisualTransition(Dali::Property::Map& sourcePropertyMap, Dali::Property::Map& destinationPropertyMap,
+                                   Dali::Toolkit::Control source, Dali::Toolkit::Control destination, Dali::Property::Index visualIndex)
+{
+  sourcePropertyMap.Clear();
+  destinationPropertyMap.Clear();
+
+  Toolkit::Visual::Base sourceVisual      = DevelControl::GetVisual(GetImplementation(source), visualIndex);
+  Toolkit::Visual::Base destinationVisual = DevelControl::GetVisual(GetImplementation(destination), visualIndex);
+
+  // If source or destination doesn't have the visual, do not create transition for the visual.
+  if(!sourceVisual || !destinationVisual)
+  {
+    return;
+  }
+
+  Property::Map sourceMap;
+  Property::Map destinationMap;
+  sourceVisual.CreatePropertyMap(sourceMap);
+  destinationVisual.CreatePropertyMap(destinationMap);
+
+  static auto findValueVector4 = [](const Property::Map& map, Property::Index index, const Vector4& defaultValue = Vector4()) -> Vector4
+  {
+    Property::Value* propertyValue = map.Find(index);
+    if(propertyValue)
+    {
+      return propertyValue->Get<Vector4>();
+    }
+    return defaultValue;
+  };
+
+  static auto findValueFloat = [](const Property::Map& map, Property::Index index, const float& defaultValue = 0.0f) -> float
+  {
+    Property::Value* propertyValue = map.Find(index);
+    if(propertyValue)
+    {
+      return propertyValue->Get<float>();
+    }
+    return defaultValue;
+  };
+
+  Vector4 defaultMixColor(Color::TRANSPARENT);
+  Vector4 defaultCornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
+  float   defaultBorderlineWidth(0.0f);
+  Vector4 defaultBorderlineColor(0.0f, 0.0f, 0.0f, 1.0f);
+  float   defaultBorderlineOffset(0.0f);
+
+  Vector4 sourceMixColor         = findValueVector4(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR, defaultMixColor);
+  Vector4 sourceCornerRadius     = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, defaultCornerRadius);
+  float   sourceBorderlineWidth  = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, defaultBorderlineWidth);
+  Vector4 sourceBorderlineColor  = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, defaultBorderlineColor);
+  float   sourceBorderlineOffset = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, defaultBorderlineOffset);
+
+  Vector4 destinationMixColor         = findValueVector4(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR, defaultMixColor);
+  Vector4 destinationCornerRadius     = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, defaultCornerRadius);
+  float   destinationBorderlineWidth  = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, defaultBorderlineWidth);
+  Vector4 destinationBorderlineColor  = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, defaultBorderlineColor);
+  float   destinationBorderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, defaultBorderlineOffset);
+
+  // If the value of the source Control and that of destination Control is different, the property should be transitioned.
+  if(Vector3(sourceMixColor) != Vector3(destinationMixColor))
+  {
+    sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, Vector3(sourceMixColor));
+    destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, Vector3(destinationMixColor));
+  }
+
+  if(std::abs(sourceMixColor.a - destinationMixColor.a) > Math::MACHINE_EPSILON_1)
+  {
+    sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::OPACITY, sourceMixColor.a);
+    destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::OPACITY, destinationMixColor.a);
+  }
+
+  if(sourceCornerRadius != destinationCornerRadius)
+  {
+    sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceCornerRadius);
+    destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationCornerRadius);
+  }
+
+  if(sourceBorderlineWidth != destinationBorderlineWidth)
+  {
+    sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
+    destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
+  }
+
+  if(sourceBorderlineColor != destinationBorderlineColor)
+  {
+    sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
+    destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
+  }
+
+  if(sourceBorderlineOffset != destinationBorderlineOffset)
+  {
+    sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
+    destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
+  }
+}
+
 Control& GetImplementation(Dali::Toolkit::Control& handle)
 {
   CustomActorImpl& customInterface = handle.GetImplementation();
index 9a68ca1..48c6b9c 100644 (file)
@@ -45,6 +45,7 @@ class StyleManager;
 
 namespace Internal
 {
+
 /**
  * @brief This is the internal base class for all controls.
  *
@@ -617,18 +618,47 @@ public: // API for derived classes to override
     return NULL;
   }
 
-  // Transition
+  // Transition APIs
+
+  /**
+   * @brief Make visual transition from source control to destination control about specific Visual.
+   * If both of source and destination control have same visual index, than generates information for the transition of this Control.
+   *
+   * @param[out] sourcePropertyMap Source property map to be applied on this Control.
+   * @param[out] destinationPropertyMap Destination property map to be applied on this Control.
+   * @param[in] source Source control of the animation.
+   * @param[in] destination Destination control of the animation.
+   * @param[in] visualIndex Property::Index to make animation.
+   */
+  void MakeVisualTransition(Dali::Property::Map& sourcePropertyMap, Dali::Property::Map& destinationPropertyMap,
+                            Dali::Toolkit::Control source, Dali::Toolkit::Control destination, Dali::Property::Index visualIndex);
 
   /**
-   * @brief Retrieve visual property animations.
-   * This Control is a destination.
+   * @brief Retrieves source and destination visual properties for the Transition of this Control.
+   * The properties of this Control will be transitioned from the propeties of source Control to that of destination control.
+   * If a property value is different between source and destination Control,
+   * the property information of each Control will be included in sourceProperties and destinationProperties.
+   *
+   * @param[out] sourceProperties Source property list to be applied on this Control.
+   * @param[out] destinationProperties Destination property list to be applied on this Control.
+   * @param[in] source Source control of the animation.
+   * @param[in] destination Destination control of the animation.
    *
-   * @param[in] animation generated animation
-   * @param[in] source source control of the animation.
-   * @param[in] alphaFunction AlphaFunction of the animation
-   * @param[in] timePeriod TimePeriod of the animation
+   * @note This method do not handle Actor properties.
+   * And the size and order of the sourceProperties and destinationProperties must be synchronized.
+   */
+  virtual void OnCreateTransitions(std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& sourceProperties,
+                                   std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& destinationProperties,
+                                   Dali::Toolkit::Control                                              source,
+                                   Dali::Toolkit::Control                                              destination)
+  {
+  }
+
+  /**
+   * @brief Update visual properties.
+   * @param[in] properties Property list to be used to update visual properties of this Control.
    */
-  virtual void OnCreateTransitions(Dali::Animation& animation, Dali::Toolkit::Control source, AlphaFunction alphaFunction, TimePeriod timePeriod)
+  virtual void OnUpdateVisualProperties(const std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& properties)
   {
   }
 
index d90a101..65c85c0 100644 (file)
@@ -29,7 +29,7 @@ namespace Toolkit
 {
 const unsigned int TOOLKIT_MAJOR_VERSION = 2;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 49;
+const unsigned int TOOLKIT_MICRO_VERSION = 50;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 3e2f378..57f7364 100644 (file)
@@ -32,9 +32,9 @@ Transition::Transition(Internal::Transition* transition)
 {
 }
 
-Transition Transition::New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, TimePeriod timePeriod)
+Transition Transition::New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, bool useDestinationTarget, TimePeriod timePeriod)
 {
-  Internal::TransitionPtr internal = Dali::Toolkit::Internal::Transition::New(source, destination, timePeriod);
+  Internal::TransitionPtr internal = Dali::Toolkit::Internal::Transition::New(source, destination, useDestinationTarget, timePeriod);
 
   return Transition(internal.Get());
 }
index 634face..fa27fa6 100644 (file)
@@ -51,13 +51,14 @@ public:
   /**
    * @brief Creates an initialized Transition.
    *
-   * @param[in] source Source
-   * @param[in] destination Destination
+   * @param[in] source A source control of this transition.
+   * @param[in] destination A destination control of this transition.
+   * @param[in] useDestinationTarget True if this transition uses destination control as target.
    * @param[in] timePeriod The duration in seconds
    * @return A handle to a newly allocated Dali resource
    * @note durationSeconds can not be negative.
    */
-  static Transition New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, TimePeriod timePeriod);
+  static Transition New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, bool useDestinationTarget, TimePeriod timePeriod);
 
   /**
    * @brief Downcasts a handle to Transition handle.
index 2945b88..2b96025 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.0.49
+Version:    2.0.50
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT