[dali_2.0.36] Merge branch 'devel/master' 43/261743/1
authorRichard Huang <r.huang@samsung.com>
Fri, 23 Jul 2021 09:29:21 +0000 (10:29 +0100)
committerRichard Huang <r.huang@samsung.com>
Fri, 23 Jul 2021 09:29:22 +0000 (10:29 +0100)
Change-Id: I7c6c370ac86e1a2b10adbd4555ca08d78b27de3e

42 files changed:
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.cpp
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.h
automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Controls-BridgeUp.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-VisualUrl.cpp
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-generator.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gesture-generator.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-native-image.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-native-image-source.cpp
automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp
automated-tests/src/dali-toolkit/utc-Dali-Image.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageUrl.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp
automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp
dali-toolkit/devel-api/controls/accessible-impl.cpp
dali-toolkit/devel-api/controls/accessible-impl.h
dali-toolkit/devel-api/focus-manager/keyboard-focus-manager-devel.cpp
dali-toolkit/devel-api/focus-manager/keyboard-focus-manager-devel.h
dali-toolkit/internal/controls/camera-view/camera-view-impl.cpp
dali-toolkit/internal/controls/camera-view/camera-view-impl.h
dali-toolkit/internal/controls/control/control-data-impl.cpp
dali-toolkit/internal/controls/control/control-data-impl.h
dali-toolkit/internal/controls/web-view/web-view-impl.cpp
dali-toolkit/internal/file.list
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h
dali-toolkit/internal/image-loader/image-url-impl.cpp [new file with mode: 0644]
dali-toolkit/internal/image-loader/image-url-impl.h [new file with mode: 0644]
dali-toolkit/internal/text/bidirectional-support.cpp
dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/transition/transition-base-impl.cpp
dali-toolkit/internal/visuals/texture-manager-impl.cpp
dali-toolkit/internal/visuals/texture-manager-impl.h
dali-toolkit/internal/visuals/visual-url.cpp
dali-toolkit/internal/visuals/visual-url.h
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/public-api/file.list
dali-toolkit/public-api/image-loader/image-url.cpp [new file with mode: 0644]
dali-toolkit/public-api/image-loader/image-url.h [new file with mode: 0644]
dali-toolkit/public-api/image-loader/image.cpp
dali-toolkit/public-api/image-loader/image.h
packaging/dali-toolkit.spec

index f8eec35..6d61f56 100644 (file)
@@ -10,6 +10,8 @@ namespace Dali {
         using MethodType = TestDBusWrapper::MethodType;
         using MessagePtr = DBusWrapper::MessagePtr;
 
+        static bool MoveOutedCalled = false;
+
         void TestEnableSC(bool b) {
             static bool firstTime = true;
             if (b && firstTime) {
@@ -71,6 +73,11 @@ namespace Dali {
                 [wr](const MessagePtr &m) -> MessagePtr {
                     return wr->newReplyMessage(m);
                 };
+                wr->testMethods[std::tuple<std::string, std::string, std::string, MethodType>{"/org/a11y/atspi/accessible", "org.a11y.atspi.Event.Object", "MoveOuted", MethodType::Method}] =
+                [wr](const MessagePtr &m) -> MessagePtr {
+                    MoveOutedCalled = true;
+                    return wr->newReplyMessage(m);
+                };
             }
             auto wr = static_cast<TestDBusWrapper*>(DBusWrapper::Installed());
             wr->fromTestChangeProperty("/org/a11y/bus", "org.a11y.Status", "ScreenReaderEnabled", b);
@@ -267,6 +274,15 @@ namespace Dali {
             return std::move(std::get<0>(chs));
         }
 
+        void TestResetMoveOutedCalled ()
+        {
+          MoveOutedCalled = false;
+        }
+
+        bool TestGetMoveOutedCalled ()
+        {
+          return MoveOutedCalled;
+        }
 
         void printTree(const Address &root, size_t depth)
         {
index 8c3d201..4966ff2 100644 (file)
@@ -36,7 +36,8 @@ namespace Dali {
         bool TestDoAction ( const Address &adr, const std::string& name );
         std::string TestGetActionKeyBinding ( const Address &adr, size_t index );
         std::string TestGetActionDescription ( const Address &adr, size_t index );
-
+        void TestResetMoveOutedCalled ();
+        bool TestGetMoveOutedCalled ();
     }
 }
 
index a6b682e..6d47f06 100644 (file)
@@ -1051,3 +1051,63 @@ int UtcDaliAccessibilityScrollToChildNonScrollable(void)
   Dali::Accessibility::TestEnableSC( false );
   END_TEST;
 }
+
+int UtcDaliAccessibilityCheckHighlight(void)
+{
+  ToolkitTestApplication application;
+  Dali::Accessibility::TestEnableSC( true );
+  Dali::Accessibility::TestResetMoveOutedCalled();
+
+  // Make precondition two children exist in parent area
+  PushButton parentButton = PushButton::New();
+  parentButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  parentButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  parentButton.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f) );
+  parentButton.SetProperty( Dali::Actor::Property::SIZE, Dali::Vector2(100.0f, 200.0f) );
+  application.GetScene().Add( parentButton );
+
+  PushButton buttonA = PushButton::New();
+  buttonA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  buttonA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  buttonA.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f) );
+  buttonA.SetProperty( Dali::Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f) );
+  parentButton.Add(buttonA);
+
+  PushButton buttonB = PushButton::New();
+  buttonB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  buttonB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  buttonB.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 100.0f) );
+  buttonB.SetProperty( Dali::Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f) );
+  parentButton.Add(buttonB);
+  Wait(application);
+
+  // Move second child out of parent area
+  auto* accessible = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(buttonA));
+  DALI_TEST_CHECK(accessible);
+  accessible->GrabHighlight();
+  Wait(application);
+
+  buttonA.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, -200.0f) );
+  Wait(application);
+  // Need one more seding notificaiton to get correct updated position
+  application.SendNotification();
+  DALI_TEST_EQUALS( true, Dali::Accessibility::TestGetMoveOutedCalled(), TEST_LOCATION );
+
+  // Reset verdict data
+  Dali::Accessibility::TestResetMoveOutedCalled();
+
+  // Move second child out of parent area
+  accessible = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(buttonB));
+  DALI_TEST_CHECK(accessible);
+  accessible->GrabHighlight();
+  Wait(application);
+
+  buttonB.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(300.0f, 100.0f) );
+  Wait(application);
+  // Need one more seding notificaiton to get correct updated position
+  application.SendNotification();
+  DALI_TEST_EQUALS( true, Dali::Accessibility::TestGetMoveOutedCalled(), TEST_LOCATION );
+
+  Dali::Accessibility::TestEnableSC( false );
+  END_TEST;
+}
index 962ad8e..c57ec89 100644 (file)
@@ -42,6 +42,18 @@ int UtcDaliVisualUrlConstructor(void)
   DALI_TEST_EQUALS( true, visualUrl3.IsValid(), TEST_LOCATION );
   DALI_TEST_EQUALS( visualUrl3.GetType(), VisualUrl::GIF, TEST_LOCATION );
   DALI_TEST_EQUALS( visualUrl3.GetProtocolType(), VisualUrl::LOCAL, TEST_LOCATION );
+
+  VisualUrl visualUrl4("dali://0");
+  visualUrl4 = visualUrl;
+  DALI_TEST_EQUALS( true, visualUrl4.IsValid(), TEST_LOCATION );
+  DALI_TEST_EQUALS( visualUrl4.GetType(), VisualUrl::GIF, TEST_LOCATION );
+  DALI_TEST_EQUALS( visualUrl4.GetProtocolType(), VisualUrl::LOCAL, TEST_LOCATION );
+
+  VisualUrl visualUrl5("dali://1");
+  visualUrl4 = visualUrl5;
+  DALI_TEST_EQUALS( true, visualUrl4.IsValid(), TEST_LOCATION );
+  DALI_TEST_EQUALS( visualUrl4.GetType(), VisualUrl::REGULAR_IMAGE, TEST_LOCATION );
+  DALI_TEST_EQUALS( visualUrl4.GetProtocolType(), VisualUrl::TEXTURE, TEST_LOCATION );
   END_TEST;
 }
 
index 9b2691c..0e984f0 100755 (executable)
@@ -26,6 +26,7 @@ SET(TC_SOURCES
   utc-Dali-Image.cpp
   utc-Dali-ImageView.cpp
   utc-Dali-ImageVisual.cpp
+  utc-Dali-ImageUrl.cpp
   utc-Dali-JsonParser.cpp
   utc-Dali-KeyInputFocusManager.cpp
   utc-Dali-PageTurnView.cpp
index 4b465a7..4532c6e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -149,16 +149,23 @@ void TestEndPan(TestApplication& application, Vector2 pos, uint32_t time)
   application.ProcessEvent(GenerateSingleTouch(PointState::UP, pos, time));
 }
 
+void TestTriggerTap(TestApplication& application)
+{
+  application.GetPlatform().TriggerTimer();
+}
+
 void TestGenerateTap(TestApplication& application, float x, float y, uint32_t time_down)
 {
   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(x, y), time_down));
   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(x, y), time_down + 20));
+  TestTriggerTap(application);
 }
 
 void TestGenerateTwoPointTap(TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down)
 {
   application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(x1, y1), PointState::DOWN, Vector2(x2, y2), time_down));
   application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(x1, y1), PointState::UP, Vector2(x2, y2), time_down + 20));
+  TestTriggerTap(application);
 }
 
 void TestGenerateRotation(TestApplication& application)
index e6e367d..cb3b1a6 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TEST_GESTURE_GENERATOR_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -94,6 +94,11 @@ void TestMovePan(TestApplication& application, Vector2 pos, uint32_t time = 400)
 void TestEndPan(TestApplication& application, Vector2 pos, uint32_t time = 500);
 
 /**
+ * Triggers the timer to begin a tap gesture
+ */
+void TestTriggerTap(TestApplication& application);
+
+/**
  * Produces a single point tap gesture with a 20ms interval
  */
 void TestGenerateTap(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time_down = 100);
index d134942..fb9451c 100644 (file)
@@ -83,6 +83,23 @@ public:
     mCallStack.PushCall("GetCustomFragmentPrefix", "");
     return "#extension GL_OES_EGL_image_external:require\n";
   };
+  inline virtual bool ApplyNativeFragmentShader(std::string& shader)
+  {
+    mCallStack.PushCall("ApplyNativeFragmentShader", "");
+    shader = "#extension GL_OES_EGL_image_external:require\n" + shader;
+
+    //Get custom sampler type name
+    const char* customSamplerTypename = GetCustomSamplerTypename();
+    if(customSamplerTypename)
+    {
+      size_t samplerPosition = shader.find("sampler2D");
+      if(samplerPosition != std::string::npos)
+      {
+        shader.replace(samplerPosition, strlen("sampler2D"), customSamplerTypename);
+      }
+    }
+    return true;
+  };
   inline const char* GetCustomSamplerTypename() const override
   {
     mCallStack.PushCall("GetCustomSamplerTypename", "");
index 11bd75b..29ea5d5 100755 (executable)
@@ -105,6 +105,11 @@ const char* NativeImageSource::GetCustomFragmentPrefix() const
   return "";
 }
 
+bool NativeImageSource::ApplyNativeFragmentShader(std::string& shader)
+{
+  return true;
+}
+
 const char* NativeImageSource::GetCustomSamplerTypename() const
 {
   return "";
index 4c5bdad..5d46d68 100644 (file)
@@ -1593,6 +1593,9 @@ int UtcDaliAnimatedVectorImageVisualFrameDrops(void)
   application.SendNotification();
   application.Render();
 
+  // Trigger count is 1 - render the first frame
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
   Property::Map attributes;
   DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
 
@@ -1602,15 +1605,12 @@ int UtcDaliAnimatedVectorImageVisualFrameDrops(void)
   application.SendNotification();
   application.Render();
 
-  // Trigger count is 1 - render the first frame
-  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
-
   // Wait for calculating frame drops
   DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
 
   // Check dropped frame
   uint32_t frames = Test::VectorAnimationRenderer::GetDroppedFrames();
-  DALI_TEST_CHECK(frames >= 9);
+  DALI_TEST_CHECK(frames > 0);
 
   END_TEST;
 }
index f19d181..37e3b5e 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/public-api/rendering/frame-buffer.h>
 #include <dali/public-api/adaptor-framework/native-image-source.h>
 #include <dali-toolkit/public-api/image-loader/image.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -51,9 +52,9 @@ int UtcDaliImageConvertFrameBufferToUrl1(void)
   FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
 
   DALI_TEST_CHECK( frameBuffer );
-  std::string url = Dali::Toolkit::Image::GenerateUrl( frameBuffer, Pixel::Format::RGBA8888, width, height );
+  ImageUrl url = Dali::Toolkit::Image::GenerateUrl( frameBuffer, Pixel::Format::RGBA8888, width, height );
 
-  DALI_TEST_CHECK( url.size() > 0u );
+  DALI_TEST_CHECK( url.GetUrl().size() > 0u );
 
   END_TEST;
 }
@@ -71,7 +72,7 @@ int UtcDaliImageConvertFrameBufferToUrl2(void)
   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
   frameBuffer.AttachColorTexture( texture );
 
-  DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( frameBuffer, 0 ).size() > 0u );
+  DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( frameBuffer, 0 ).GetUrl().size() > 0u );
 
   END_TEST;
 }
@@ -89,7 +90,7 @@ int UtcDaliImageConvertPixelDataToUrl(void)
   unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
   PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE );
 
-  DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( pixelData ).size() > 0u );
+  DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( pixelData ).GetUrl().size() > 0u );
 
   END_TEST;
 }
@@ -106,7 +107,7 @@ int UtcDaliImageConvertNativeImageSourceToUrl(void)
   {
     NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, height, NativeImageSource::COLOR_DEPTH_DEFAULT );
 
-    DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( nativeImageSource ).size() > 0u );
+    DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( nativeImageSource ).GetUrl().size() > 0u );
   }
   catch(Dali::DaliException& e)
   {
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ImageUrl.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ImageUrl.cpp
new file mode 100644 (file)
index 0000000..09cc7cd
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+int UtcImageUrlConstructor(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline(" UtcImageUrlValid ");
+
+  // Test default constructor.
+  ImageUrl imageUrl;
+  DALI_TEST_CHECK( !imageUrl );
+
+  // Test object creation
+  Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u); // test texture
+  imageUrl = ImageUrl::New(image);
+  DALI_TEST_CHECK( imageUrl );
+
+  // Test copy constructor
+  ImageUrl ImageUrlCopy( imageUrl );
+  DALI_TEST_CHECK( ImageUrlCopy );
+
+  // Test down cast
+  BaseHandle baseUrl;
+  baseUrl = imageUrl;
+  ImageUrl downcastUrl = ImageUrl::DownCast( baseUrl );
+  DALI_TEST_CHECK( downcastUrl );
+  END_TEST;
+}
\ No newline at end of file
index fdf1697..40ca439 100644 (file)
@@ -25,6 +25,7 @@
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
 #include <dali-toolkit/public-api/image-loader/image.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include "dummy-control.h"
 
@@ -424,7 +425,8 @@ int UtcDaliImageVisualWithNativeImage(void)
   tet_infoline( "Use Native Image as url" );
 
   NativeImageSourcePtr nativeImageSource = NativeImageSource::New(500, 500, NativeImageSource::COLOR_DEPTH_DEFAULT);
-  std::string url = Dali::Toolkit::Image::GenerateUrl(nativeImageSource);
+  ImageUrl imageUrl = Dali::Toolkit::Image::GenerateUrl(nativeImageSource);
+  std::string url = imageUrl.GetUrl();
 
   VisualFactory factory = VisualFactory::Get();
   DALI_TEST_CHECK( factory );
@@ -462,6 +464,62 @@ int UtcDaliImageVisualWithNativeImage(void)
   END_TEST;
 }
 
+int UtcDaliImageVisualWithNativeImageRemoved(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "Use Native Image as url" );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
+  NativeImageSourcePtr nativeImageSource = NativeImageSource::New(500, 500, NativeImageSource::COLOR_DEPTH_DEFAULT);
+  ImageUrl imageUrl = Dali::Toolkit::Image::GenerateUrl(nativeImageSource);
+  std::string url = imageUrl.GetUrl();
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  Property::Map propertyMap;
+  propertyMap.Insert( Toolkit::Visual::Property::TYPE,  Visual::IMAGE );
+  propertyMap.Insert( ImageVisual::Property::URL,  url );
+
+  Visual::Base visual = factory.CreateVisual( propertyMap );
+  DALI_TEST_CHECK( visual );
+
+  DummyControl actor = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual(  DummyControl::Property::TEST_VISUAL, visual );
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+
+  application.GetScene().Add( actor );
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
+
+  tet_infoline( "No delete texture because reference count is not zero" );
+  imageUrl.Reset();
+  application.GetScene().Remove( actor );
+  dummyImpl.UnregisterVisual( DummyControl::Property::TEST_VISUAL );
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
+
+  tet_infoline( "Delete texture because reference count is zero" );
+  visual.Reset();
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliImageVisualTextureReuse1(void)
 {
   ToolkitTestApplication application;
index 053b25c..37c6ded 100644 (file)
@@ -1689,6 +1689,9 @@ int UtcDaliKeyboardFocusManagerWithoutFocusablePropertiesMoveFocus(void)
   focusChangedCallback.Reset();
 
   // without set the navigation properties, but we can focus move
+  // enable the default algorithm
+  Dali::Toolkit::DevelKeyboardFocusManager::EnableDefaultAlgorithm(manager, true);
+  DALI_TEST_CHECK( Dali::Toolkit::DevelKeyboardFocusManager::IsDefaultAlgorithmEnabled(manager) );
 
   // Move the focus towards right
   // button1 -- [button2]
@@ -1898,4 +1901,95 @@ int UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActorInTouchMode(void)
   DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
 
   END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliKeyboardFocusManagerEnableDefaultAlgorithm(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline(" UtcDaliKeyboardFocusManagerEnableDefaultAlgorithm");
+
+  // Register Type
+  TypeInfo type;
+  type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+  DALI_TEST_CHECK( type );
+  BaseHandle handle = type.CreateInstance();
+  DALI_TEST_CHECK( handle );
+
+  KeyboardFocusManager manager = KeyboardFocusManager::Get();
+  DALI_TEST_CHECK(manager);
+
+  bool focusChangedSignalVerified = false;
+  FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
+  manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
+
+  PushButton button1 = PushButton::New();
+  PushButton button2 = PushButton::New();
+
+  button1.SetProperty(Actor::Property::SIZE, Vector2(50, 50));
+  button2.SetProperty(Actor::Property::SIZE, Vector2(50, 50));
+
+  button1.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE,true);
+  button2.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE,true);
+
+  application.GetScene().Add(button1);
+  application.GetScene().Add(button2);
+
+  // set position
+  // button1 -- button2
+  button1.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+  button2.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 0.0f));
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  // Set the focus to the button1
+  // [button1] -- button2
+  DALI_TEST_CHECK(manager.SetCurrentFocusActor(button1) == true);
+  DALI_TEST_CHECK(manager.GetCurrentFocusActor() == button1);
+  DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+  DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
+  DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == button1);
+  focusChangedCallback.Reset();
+
+  // without set the navigation properties, but we can focus move
+  // enable the default algorithm
+  Dali::Toolkit::DevelKeyboardFocusManager::EnableDefaultAlgorithm(manager, true);
+  DALI_TEST_CHECK( Dali::Toolkit::DevelKeyboardFocusManager::IsDefaultAlgorithmEnabled(manager) );
+
+  // Move the focus towards right
+  // button1 -- [button2]
+  DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == true);
+
+  // Confirm whether focus is moved to button2
+  DALI_TEST_EQUALS(button2.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION);
+  DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+  DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == button1);
+  DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == button2);
+  focusChangedCallback.Reset();
+
+  // disable the default algorithm
+  Dali::Toolkit::DevelKeyboardFocusManager::EnableDefaultAlgorithm(manager, false);
+  DALI_TEST_CHECK( !Dali::Toolkit::DevelKeyboardFocusManager::IsDefaultAlgorithmEnabled(manager) );
+
+  // Move the focus towards left, The focus move will fail because the default algorithm is disabled.
+  DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == false);
+
+  // enable the default algorithm
+  Dali::Toolkit::DevelKeyboardFocusManager::EnableDefaultAlgorithm(manager, true);
+  DALI_TEST_CHECK( Dali::Toolkit::DevelKeyboardFocusManager::IsDefaultAlgorithmEnabled(manager) );
+
+  // Move the focus towards left, The focus move will success because the default algorithm is enabled.
+  // [button1] -- button2
+  DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
+  // Confirm whether focus is moved to button2
+  DALI_TEST_EQUALS(button1.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION);
+  DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+  DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == button2);
+  DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == button1);
+  focusChangedCallback.Reset();
+
+
+  END_TEST;
+}
index c42cb8a..774a280 100644 (file)
@@ -328,6 +328,22 @@ void AccessibleImpl::ScrollToSelf()
   }
 }
 
+void AccessibleImpl::RegisterPositionPropertyNotification()
+{
+  auto                     control         = Dali::Toolkit::Control::DownCast(Self());
+  Internal::Control&       internalControl = Toolkit::Internal::GetImplementation(control);
+  Internal::Control::Impl& controlImpl     = Internal::Control::Impl::Get(internalControl);
+  controlImpl.RegisterAccessibilityPositionPropertyNotification();
+}
+
+void AccessibleImpl::UnregisterPositionPropertyNotification()
+{
+  auto                     control         = Dali::Toolkit::Control::DownCast(Self());
+  Internal::Control&       internalControl = Toolkit::Internal::GetImplementation(control);
+  Internal::Control::Impl& controlImpl     = Internal::Control::Impl::Get(internalControl);
+  controlImpl.UnregisterAccessibilityPositionPropertyNotification();
+}
+
 bool AccessibleImpl::GrabHighlight()
 {
   Dali::Actor self = Self();
@@ -360,11 +376,15 @@ bool AccessibleImpl::GrabHighlight()
     SetHighlightActor(highlight);
   }
 
-  highlight.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
-  highlight.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+  highlight.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
   highlight.SetProperty(Actor::Property::POSITION_Z, 1.0f);
   highlight.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
 
+  // Need to set resize policy again, to update SIZE property which is set by
+  // AccessibleImpl_NUI. The highlight could move from AccessibleImpl_NUI to
+  // AccessibleImpl. In this case, highlight has incorrect size.
+  highlight.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
+
   // Remember the highlight actor, so that when the default is changed with
   // SetHighlightActor(), the currently displayed highlight can still be cleared.
   mCurrentHighlightActor = highlight;
@@ -372,6 +392,7 @@ bool AccessibleImpl::GrabHighlight()
   self.Add(highlight);
   SetCurrentlyHighlightedActor(self);
   EmitHighlighted(true);
+  RegisterPositionPropertyNotification();
 
   return true;
 }
@@ -387,6 +408,7 @@ bool AccessibleImpl::ClearHighlight()
 
   if(GetCurrentlyHighlightedActor() == self)
   {
+    UnregisterPositionPropertyNotification();
     self.Remove(mCurrentHighlightActor.GetHandle());
     mCurrentHighlightActor = {};
     SetCurrentlyHighlightedActor({});
@@ -495,4 +517,14 @@ Dali::Property::Index AccessibleImpl::GetDescriptionPropertyIndex()
   return Dali::Property::INVALID_INDEX;
 }
 
+void AccessibleImpl::SetLastPosition(Vector2 position)
+{
+  mLastPosition = position;
+}
+
+Vector2 AccessibleImpl::GetLastPosition() const
+{
+  return mLastPosition;
+}
+
 } // namespace Dali::Toolkit::DevelControl
index 37e7ad3..c8c1361 100644 (file)
@@ -47,6 +47,7 @@ struct DALI_TOOLKIT_API AccessibleImpl : public virtual Dali::Accessibility::Acc
                                          public virtual Dali::Accessibility::Action
 {
 protected:
+  Vector2                       mLastPosition{0.0f, 0.0f};
   Dali::WeakHandle<Dali::Actor> mSelf;
   Dali::WeakHandle<Dali::Actor> mCurrentHighlightActor;
   bool mIsModal = false;
@@ -65,6 +66,16 @@ protected:
 
   void ScrollToSelf();
 
+  /**
+   * @brief Register property notification to check highlighted object position
+   */
+  void RegisterPositionPropertyNotification();
+
+  /**
+   * @brief Remove property notification added by RegisterPropertyNotification
+   */
+  void UnregisterPositionPropertyNotification();
+
 public:
   AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);
 
@@ -228,6 +239,18 @@ public:
    * @brief Returns the index of the property that represents this actor's description
    */
   virtual Dali::Property::Index GetDescriptionPropertyIndex();
+
+  /**
+   * @brief Sets last object position
+   * @param[in] position Last object position
+   */
+  void SetLastPosition(Vector2 position);
+
+  /**
+   * @brief Gets last object position
+   * @return The Last object position
+   */
+  Vector2 GetLastPosition() const;
 };
 
 } // namespace Dali::Toolkit::DevelControl
index faa7fc1..f320269 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -40,6 +40,16 @@ bool IsFocusIndicatorEnabled(KeyboardFocusManager keyboardFocusManager)
   return GetImpl(keyboardFocusManager).IsFocusIndicatorEnabled();
 }
 
+void EnableDefaultAlgorithm(KeyboardFocusManager keyboardFocusManager, bool enable)
+{
+  GetImpl(keyboardFocusManager).EnableDefaultAlgorithm(enable);
+}
+
+bool IsDefaultAlgorithmEnabled(KeyboardFocusManager keyboardFocusManager)
+{
+  return GetImpl(keyboardFocusManager).IsDefaultAlgorithmEnabled();
+}
+
 } // namespace DevelKeyboardFocusManager
 
 } // namespace Toolkit
index afe3e43..192c296 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_KEYBOARD_FOCUS_MANAGER_DEVEL_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -84,6 +84,22 @@ DALI_TOOLKIT_API void EnableFocusIndicator(KeyboardFocusManager keyboardFocusMan
  */
 DALI_TOOLKIT_API bool IsFocusIndicatorEnabled(KeyboardFocusManager keyboardFocusManager);
 
+/**
+ * @brief Decide using default focus algorithm or not
+ *
+ * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
+ * @param[in] enable Whether using default focus algorithm or not
+ */
+DALI_TOOLKIT_API void EnableDefaultAlgorithm(KeyboardFocusManager keyboardFocusManager, bool enable);
+
+/**
+ * @brief Check default focus algorithm is enabled or not
+ *
+ * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
+ * @return True when default focus algorithm is enabled
+ */
+DALI_TOOLKIT_API bool IsDefaultAlgorithmEnabled(KeyboardFocusManager keyboardFocusManager);
+
 } // namespace DevelKeyboardFocusManager
 
 } // namespace Toolkit
index 9ca121b..772c1a0 100644 (file)
@@ -145,7 +145,7 @@ void CameraView::SetNativeImageTarget()
   mNativeTexture                                  = Dali::Texture::New(*nativeImageSourcePtr);
 
   Dali::Geometry   geometry   = VisualFactoryCache::CreateQuadGeometry();
-  Dali::Shader     shader     = CreateShader(nativeImageSourcePtr->GetCustomFragmentPrefix());
+  Dali::Shader     shader     = CreateShader(nativeImageSourcePtr);
   Dali::TextureSet textureSet = Dali::TextureSet::New();
   textureSet.SetTexture(0u, mNativeTexture);
 
@@ -181,13 +181,12 @@ void CameraView::UpdateDisplayArea(Dali::PropertyNotification& source)
   mCameraPlayer.SetDisplayArea(mDisplayArea);
 }
 
-Dali::Shader CameraView::CreateShader(const char* fragmentPrefix)
+Dali::Shader CameraView::CreateShader(Dali::NativeImageSourcePtr nativeImageSourcePtr)
 {
-  std::string fragmentShader = fragmentPrefix;
-  std::string vertexShader;
+  std::string vertexShader = SHADER_VIDEO_VIEW_TEXTURE_VERT.data();
+  std::string fragmentShader = SHADER_VIDEO_VIEW_TEXTURE_FRAG.data();
 
-  vertexShader = SHADER_VIDEO_VIEW_TEXTURE_VERT.data();
-  fragmentShader += SHADER_VIDEO_VIEW_TEXTURE_FRAG.data();
+  nativeImageSourcePtr->ApplyNativeFragmentShader(fragmentShader);
 
   return Dali::Shader::New(vertexShader, fragmentShader);
 }
index 6c77889..cc5ba82 100644 (file)
@@ -101,10 +101,10 @@ private:
 
   /**
    * @brief CreateShader for native image target
-   * @param[in] fragmentPrefix prefix of fragment
+   * @param[in] nativeImageSourcePtr to apply custom fragment prefix
    * @return Returns the shader for NativeImage.
    */
-  Dali::Shader CreateShader(const char* fragmentPrefix);
+  Dali::Shader CreateShader(Dali::NativeImageSourcePtr nativeImageSourcePtr);
 
 private:
   Dali::CameraPlayer mCameraPlayer;
index db346bd..8fd35e0 100644 (file)
@@ -410,6 +410,35 @@ void SetVisualsOffScene(const RegisteredVisualContainer& container, Actor parent
   }
 }
 
+Dali::Rect<> GetShowingGeometry(Dali::Rect<> rect, Dali::Toolkit::DevelControl::AccessibleImpl* accessibleImpl)
+{
+  Rect<>  parentRect;
+  Vector2 currentPosition;
+  auto    parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(accessibleImpl->GetParent());
+
+  while(parent)
+  {
+    parentRect = parent->GetExtents(Dali::Accessibility::CoordinateType::WINDOW);
+
+    currentPosition.x = rect.x;
+    currentPosition.y = rect.y;
+
+    rect.x      = rect.x > parentRect.x ? rect.x : parentRect.x;
+    rect.y      = rect.y > parentRect.y ? rect.y : parentRect.y;
+    rect.width  = currentPosition.x + rect.width < parentRect.x + parentRect.width ? currentPosition.x + rect.width - rect.x : parentRect.x + parentRect.width - rect.x;
+    rect.height = currentPosition.y + rect.height < parentRect.y + parentRect.height ? currentPosition.y + rect.height - rect.y : parentRect.y + parentRect.height - rect.y;
+
+    if(rect.width < 0 || rect.height < 0)
+    {
+      return rect;
+    }
+
+    parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(parent->GetParent());
+  }
+
+  return rect;
+}
+
 } // unnamed namespace
 
 // clang-format off
@@ -518,6 +547,70 @@ const Control::Impl& Control::Impl::Get(const Internal::Control& internalControl
   return *internalControl.mImpl;
 }
 
+void Control::Impl::CheckHighlightedObjectGeometry(PropertyNotification& propertyNotification)
+{
+  auto accessibleImpl = dynamic_cast<Dali::Toolkit::DevelControl::AccessibleImpl*>(mAccessibilityObject.get());
+  auto lastPosition   = accessibleImpl->GetLastPosition();
+  auto accessibleRect = accessibleImpl->GetExtents(Dali::Accessibility::CoordinateType::WINDOW);
+
+  if(lastPosition.x == accessibleRect.x && lastPosition.y == accessibleRect.y)
+  {
+    return;
+  }
+
+  auto rect = GetShowingGeometry(accessibleRect, accessibleImpl);
+
+  // MoveOuted is sent already, no need to send it again
+  if(mAccessibilityMovedOutOfScreenDirection != Dali::Accessibility::MovedOutOfScreenType::NONE)
+  {
+    if(rect.width > 0 && rect.height > 0)
+    {
+      // flick next does not use MoveOuted - ScrollToSelf makes object show, so reset for sending MoveOuted next
+      mAccessibilityMovedOutOfScreenDirection = Dali::Accessibility::MovedOutOfScreenType::NONE;
+    }
+    return;
+  }
+
+  if(rect.width < 0)
+  {
+    mAccessibilityMovedOutOfScreenDirection = (accessibleRect.x < lastPosition.x) ? Dali::Accessibility::MovedOutOfScreenType::TOP_LEFT : Dali::Accessibility::MovedOutOfScreenType::BOTTOM_RIGHT;
+  }
+
+  if(rect.height < 0)
+  {
+    mAccessibilityMovedOutOfScreenDirection = (accessibleRect.y < lastPosition.y) ? Dali::Accessibility::MovedOutOfScreenType::TOP_LEFT : Dali::Accessibility::MovedOutOfScreenType::BOTTOM_RIGHT;
+  }
+
+  if(mAccessibilityMovedOutOfScreenDirection != Dali::Accessibility::MovedOutOfScreenType::NONE)
+  {
+    mAccessibilityObject.get()->EmitMovedOutOfScreen(mAccessibilityMovedOutOfScreenDirection);
+    accessibleImpl->SetLastPosition(Vector2(0.0f, 0.0f));
+    return;
+  }
+
+  accessibleImpl->SetLastPosition(Vector2(accessibleRect.x, accessibleRect.y));
+}
+
+void Control::Impl::RegisterAccessibilityPositionPropertyNotification()
+{
+  if(mIsAccessibilityPositionPropertyNotificationSet)
+  {
+    return;
+  }
+
+  mAccessibilityMovedOutOfScreenDirection = Dali::Accessibility::MovedOutOfScreenType::NONE;
+  mAccessibilityPositionNotification      = mControlImpl.Self().AddPropertyNotification(Actor::Property::WORLD_POSITION, StepCondition(1.0f, 1.0f));
+  mAccessibilityPositionNotification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
+  mAccessibilityPositionNotification.NotifySignal().Connect(this, &Control::Impl::CheckHighlightedObjectGeometry);
+  mIsAccessibilityPositionPropertyNotificationSet = true;
+}
+
+void Control::Impl::UnregisterAccessibilityPositionPropertyNotification()
+{
+  mControlImpl.Self().RemovePropertyNotification(mAccessibilityPositionNotification);
+  mIsAccessibilityPositionPropertyNotificationSet = false;
+}
+
 // Gesture Detection Methods
 void Control::Impl::PinchDetected(Actor actor, const PinchGesture& pinch)
 {
index e278390..4c480a0 100644 (file)
@@ -468,6 +468,22 @@ private:
    */
   void OnIdleCallback();
 
+  /**
+   * @brief Checks highlighted object geometry if it is showing or not
+   * @param[in] propertyNotification PropertyNotification
+   */
+  void CheckHighlightedObjectGeometry(Dali::PropertyNotification& propertyNotification);
+
+  /**
+   * @brief Register property notification to check highlighted object position
+   */
+  void RegisterAccessibilityPositionPropertyNotification();
+
+  /**
+   * @brief Remove property notification added by RegisterPropertyNotification
+   */
+  void UnregisterAccessibilityPositionPropertyNotification();
+
 public:
   Control&            mControlImpl;
   DevelControl::State mState;
@@ -562,6 +578,12 @@ public:
   static const PropertyRegistration PROPERTY_20;
   static const PropertyRegistration PROPERTY_21;
   static const PropertyRegistration PROPERTY_22;
+
+private:
+  // Accessibility - notification for highlighted object to check if it is showing.
+  bool                                      mIsAccessibilityPositionPropertyNotificationSet{false};
+  Dali::PropertyNotification                mAccessibilityPositionNotification;
+  Dali::Accessibility::MovedOutOfScreenType mAccessibilityMovedOutOfScreenDirection;
 };
 
 } // namespace Internal
index 0457186..170495c 100755 (executable)
@@ -52,6 +52,7 @@
 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
 #include <dali-toolkit/public-api/image-loader/image.h>
 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
 
 namespace Dali
 {
@@ -634,8 +635,8 @@ Dali::Toolkit::ImageView WebView::CreateImageView(Dali::PixelData pixel) const
     return Dali::Toolkit::ImageView();
   }
 
-  std::string              url       = Dali::Toolkit::Image::GenerateUrl(pixel);
-  Dali::Toolkit::ImageView imageView = Dali::Toolkit::ImageView::New(url);
+  Dali::Toolkit::ImageUrl url       = Dali::Toolkit::Image::GenerateUrl(pixel);
+  Dali::Toolkit::ImageView imageView = Dali::Toolkit::ImageView::New(url.GetUrl());
   imageView.SetProperty(Dali::Actor::Property::SIZE, Vector2(pixel.GetWidth(), pixel.GetHeight()));
   return imageView;
 }
index 9cab1a6..a661176 100644 (file)
@@ -124,6 +124,7 @@ SET( toolkit_src_files
    ${toolkit_src_dir}/image-loader/atlas-packer.cpp
    ${toolkit_src_dir}/image-loader/image-atlas-impl.cpp
    ${toolkit_src_dir}/image-loader/image-load-thread.cpp
+   ${toolkit_src_dir}/image-loader/image-url-impl.cpp
    ${toolkit_src_dir}/styling/style-manager-impl.cpp
    ${toolkit_src_dir}/text/bidirectional-support.cpp
    ${toolkit_src_dir}/text/character-set-conversion.cpp
index c03b7dd..b10ff63 100644 (file)
@@ -127,7 +127,8 @@ KeyboardFocusManager::KeyboardFocusManager()
   mAlwaysShowIndicator(ALWAYS_SHOW),
   mFocusGroupLoopEnabled(false),
   mIsWaitingKeyboardFocusChangeCommit(false),
-  mClearFocusOnTouch(true)
+  mClearFocusOnTouch(true),
+  mEnableDefaultAlgorithm(false)
 {
   // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorShown.
 
@@ -497,7 +498,7 @@ bool KeyboardFocusManager::MoveFocus(Toolkit::Control::KeyboardFocus::Direction
         nextFocusableActor                  = mPreFocusChangeSignal.Emit(currentFocusActor, Actor(), direction);
         mIsWaitingKeyboardFocusChangeCommit = false;
       }
-      else
+      else if(mEnableDefaultAlgorithm)
       {
         // We should find it among the actors nearby.
         nextFocusableActor = Toolkit::FocusFinder::GetNearestFocusableActor(currentFocusActor, direction);
@@ -1084,6 +1085,16 @@ bool KeyboardFocusManager::IsFocusIndicatorEnabled() const
   return (mEnableFocusIndicator == ENABLE);
 }
 
+void KeyboardFocusManager::EnableDefaultAlgorithm(bool enable)
+{
+  mEnableDefaultAlgorithm = enable;
+}
+
+bool KeyboardFocusManager::IsDefaultAlgorithmEnabled() const
+{
+  return mEnableDefaultAlgorithm;
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
index 07bf86f..8212a79 100644 (file)
@@ -152,6 +152,16 @@ public:
    */
   bool IsFocusIndicatorEnabled() const;
 
+  /**
+   * @copydoc Toolkit::DevelKeyboardFocusManager::EnableDefaultAlgorithm
+   */
+  void EnableDefaultAlgorithm(bool enable);
+
+  /**
+   * @copydoc Toolkit::DevelKeyboardFocusManager::IsDefaultAlgorithmEnabled
+   */
+  bool IsDefaultAlgorithmEnabled() const;
+
 public:
   /**
    * @copydoc Toolkit::KeyboardFocusManager::PreFocusChangeSignal()
@@ -332,6 +342,8 @@ private:
   bool mIsWaitingKeyboardFocusChangeCommit : 1; /// A flag to indicate PreFocusChangeSignal emitted but the proposed focus actor is not commited by the application yet.
 
   bool mClearFocusOnTouch : 1; ///< Whether clear focus on touch.
+
+  bool mEnableDefaultAlgorithm : 1; ///< Whether use default algorithm focus
 };
 
 } // namespace Internal
diff --git a/dali-toolkit/internal/image-loader/image-url-impl.cpp b/dali-toolkit/internal/image-loader/image-url-impl.cpp
new file mode 100644 (file)
index 0000000..055738f
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
+#include <dali-toolkit/internal/image-loader/image-url-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+ImageUrl::ImageUrl(Texture& texture)
+: mUrl("")
+{
+  mUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
+}
+
+ImageUrl::~ImageUrl()
+{
+  Dali::Toolkit::TextureManager::RemoveTexture(mUrl);
+}
+
+ImageUrlPtr ImageUrl::New(Texture& texture)
+{
+  ImageUrlPtr imageUrlPtr = new ImageUrl(texture);
+  return imageUrlPtr;
+}
+
+const std::string& ImageUrl::GetUrl() const
+{
+  return mUrl;
+}
+
+} // End of namespace Internal
+
+} // End of namespace Toolkit
+
+} // End of namespace Dali
diff --git a/dali-toolkit/internal/image-loader/image-url-impl.h b/dali-toolkit/internal/image-loader/image-url-impl.h
new file mode 100644 (file)
index 0000000..45981b2
--- /dev/null
@@ -0,0 +1,97 @@
+#ifndef DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
+#define DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/image-loader/image-url.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+class ImageUrl;
+using ImageUrlPtr = IntrusivePtr<ImageUrl>;
+
+class ImageUrl : public BaseObject
+{
+public:
+  /**
+   * @brief Constructor.
+   */
+  ImageUrl(Texture& texture);
+
+  /**
+   * @copydoc Dali::Toolkit::ImageUrl::New
+   */
+  static ImageUrlPtr New(Texture& texture);
+
+  /**
+   * @copydoc Dali::Toolkit::ImageUrl::GetUrl
+   */
+  const std::string& GetUrl() const;
+
+protected:
+  /**
+   * @brief A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~ImageUrl();
+
+private:
+  // Undefined
+  ImageUrl(const ImageUrl&);
+
+  // Undefined
+  ImageUrl& operator=(const ImageUrl& rhs);
+
+private:
+  std::string mUrl;
+};
+
+} // namespace Internal
+} // namespace Toolkit
+
+// Helpers for public-api forwarding methods
+
+inline Toolkit::Internal::ImageUrl& GetImpl(Dali::Toolkit::ImageUrl& imageUrl)
+{
+  DALI_ASSERT_ALWAYS(imageUrl && "ImageUrl handle is empty");
+
+  BaseObject& handle = imageUrl.GetBaseObject();
+
+  return static_cast<Toolkit::Internal::ImageUrl&>(handle);
+}
+
+inline const Toolkit::Internal::ImageUrl& GetImpl(const Dali::Toolkit::ImageUrl& imageUrl)
+{
+  DALI_ASSERT_ALWAYS(imageUrl && "ImageUrl handle is empty");
+
+  const BaseObject& handle = imageUrl.GetBaseObject();
+
+  return static_cast<const Toolkit::Internal::ImageUrl&>(handle);
+}
+
+} // End of namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
index c469275..9bf27f8 100644 (file)
@@ -170,7 +170,7 @@ void ReorderLine(const BidirectionalParagraphInfoRun& bidirectionalParagraphInfo
 
   lineInfoRun.visualToLogicalMapSecondHalf = reinterpret_cast<CharacterIndex*>(malloc(numberOfCharactersInSecondHalfLine * sizeof(CharacterIndex)));
 
-  if(nullptr != lineInfoRun.visualToLogicalMap)
+  if(nullptr != lineInfoRun.visualToLogicalMap && nullptr != lineInfoRun.visualToLogicalMapSecondHalf)
   {
     // Reorders the line.
     bidirectionalSupport.Reorder(bidirectionalParagraphInfo.bidirectionalInfoIndex,
index 077b598..b27f634 100644 (file)
@@ -1881,7 +1881,7 @@ struct Engine::Impl
             linesBuffer[lineIndex].ellipsis = false;
           }
           numberOfLines--;
-          ellipsisLineIndex = middleLineIndex > 0u ? middleLineIndex - 1u : 0u;
+          ellipsisLineIndex = middleLineIndex - 1u;
           middleLineIndex   = (numberOfLines) / 2u;
         }
 
@@ -2071,18 +2071,23 @@ struct Engine::Impl
 
   void Initialize(LineRun& line)
   {
-    line.glyphRun.glyphIndex             = 0u;
-    line.glyphRun.numberOfGlyphs         = 0u;
-    line.characterRun.characterIndex     = 0u;
-    line.characterRun.numberOfCharacters = 0u;
-    line.width                           = 0.f;
-    line.ascender                        = 0.f;
-    line.descender                       = 0.f;
-    line.extraLength                     = 0.f;
-    line.alignmentOffset                 = 0.f;
-    line.direction                       = LTR;
-    line.ellipsis                        = false;
-    line.lineSpacing                     = mDefaultLineSpacing;
+    line.glyphRun.glyphIndex                              = 0u;
+    line.glyphRun.numberOfGlyphs                          = 0u;
+    line.characterRun.characterIndex                      = 0u;
+    line.characterRun.numberOfCharacters                  = 0u;
+    line.width                                            = 0.f;
+    line.ascender                                         = 0.f;
+    line.descender                                        = 0.f;
+    line.extraLength                                      = 0.f;
+    line.alignmentOffset                                  = 0.f;
+    line.direction                                        = LTR;
+    line.ellipsis                                         = false;
+    line.lineSpacing                                      = mDefaultLineSpacing;
+    line.isSplitToTwoHalves                               = false;
+    line.glyphRunSecondHalf.glyphIndex                    = 0u;
+    line.glyphRunSecondHalf.numberOfGlyphs                = 0u;
+    line.characterRunForSecondHalfLine.characterIndex     = 0u;
+    line.characterRunForSecondHalfLine.numberOfCharacters = 0u;
   }
 
   Type  mLayout;
index 241eb06..ca34d77 100644 (file)
@@ -219,10 +219,11 @@ void TransitionBase::CopyTarget()
 {
   mCopiedActor = Dali::Actor::New();
   mTarget.GetParent().Add(mCopiedActor);
+
   mCopiedActor[Dali::DevelActor::Property::SIBLING_ORDER] = static_cast<int32_t>(mTarget[Dali::DevelActor::Property::SIBLING_ORDER]) + 1;
-  for(uint32_t i = 0; i < mTarget.GetChildCount(); ++i)
+  while(mTarget.GetChildCount() > 0)
   {
-    Dali::Actor child = mTarget.GetChildAt(i);
+    Dali::Actor child = mTarget.GetChildAt(0);
     Dali::DevelActor::SwitchParent(child, mCopiedActor);
   }
 
@@ -238,9 +239,9 @@ void TransitionBase::TransitionFinished()
   mTarget.SetProperties(mOriginalPropertyMap);
   if(mMoveTargetChildren)
   {
-    for(uint32_t i = 0; i < mCopiedActor.GetChildCount(); ++i)
+    while(mCopiedActor.GetChildCount() > 0)
     {
-      Dali::Actor child = mCopiedActor.GetChildAt(i);
+      Dali::Actor child = mCopiedActor.GetChildAt(0);
       Dali::DevelActor::SwitchParent(child, mTarget);
     }
     mCopiedActor.Unparent();
index a449997..b225d8d 100644 (file)
@@ -519,6 +519,7 @@ TextureManager::TextureId TextureManager::RequestLoadInternal(
 void TextureManager::Remove(const TextureManager::TextureId textureId, TextureUploadObserver* observer)
 {
   int textureInfoIndex = GetCacheIndexFromId(textureId);
+
   if(textureInfoIndex != INVALID_INDEX)
   {
     TextureInfo& textureInfo(mTextureInfoContainer[textureInfoIndex]);
@@ -660,6 +661,7 @@ std::string TextureManager::AddExternalTexture(TextureSet& textureSet)
   info.textureId  = GenerateUniqueTextureId();
   info.textureSet = textureSet;
   mExternalTextures.emplace_back(info);
+
   return VisualUrl::CreateTextureUrl(std::to_string(info.textureId));
 }
 
@@ -668,10 +670,9 @@ TextureSet TextureManager::RemoveExternalTexture(const std::string& url)
   if(url.size() > 0u)
   {
     // get the location from the Url
-    VisualUrl parseUrl(url);
-    if(VisualUrl::TEXTURE == parseUrl.GetProtocolType())
+    if(VisualUrl::TEXTURE == VisualUrl::GetProtocolType(url))
     {
-      std::string location = parseUrl.GetLocation();
+      std::string location = VisualUrl::GetLocation(url);
       if(location.size() > 0u)
       {
         TextureId  id  = std::stoi(location);
@@ -681,7 +682,10 @@ TextureSet TextureManager::RemoveExternalTexture(const std::string& url)
           if(iter->textureId == id)
           {
             auto textureSet = iter->textureSet;
-            mExternalTextures.erase(iter);
+            if(--(iter->referenceCount) <= 0)
+            {
+              mExternalTextures.erase(iter);
+            }
             return textureSet;
           }
         }
@@ -691,6 +695,26 @@ TextureSet TextureManager::RemoveExternalTexture(const std::string& url)
   return TextureSet();
 }
 
+void TextureManager::UseExternalTexture(const VisualUrl& url)
+{
+  if(VisualUrl::TEXTURE == url.GetProtocolType())
+  {
+    std::string location = url.GetLocation();
+    if(location.size() > 0u)
+    {
+      TextureId id = std::stoi(location);
+      for(auto&& elem : mExternalTextures)
+      {
+        if(elem.textureId == id)
+        {
+          elem.referenceCount++;
+          return;
+        }
+      }
+    }
+  }
+}
+
 void TextureManager::AddObserver(TextureManager::LifecycleObserver& observer)
 {
   // make sure an observer doesn't observe the same object twice
index 089ae92..c9618a9 100644 (file)
@@ -403,6 +403,12 @@ public:
   TextureSet RemoveExternalTexture(const std::string& url);
 
   /**
+   * @brief Notify that external textures are used.
+   * @param[in] url The URL of the texture to use.
+   */
+  void UseExternalTexture(const VisualUrl& url);
+
+  /**
    * Add an observer to the object.
    * @param[in] observer The observer to add.
    */
@@ -850,6 +856,7 @@ private:
   {
     TextureId  textureId;
     TextureSet textureSet;
+    int16_t    referenceCount{1};
   };
 
 private:
index e498313..1979f78 100644 (file)
 // EXTERNAL HEADERS
 #include <cstring> // for toupper()
 
+// INTERNAL HEADERS
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
+
 namespace Dali
 {
 namespace Toolkit
@@ -209,6 +213,14 @@ VisualUrl::VisualUrl(const std::string& url)
       // TEXTURE location url doesn't need type resolving, REGULAR_IMAGE is fine
       mType = ResolveType(url);
     }
+    else
+    {
+      Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
+      if(factory)
+      {
+        GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
+      }
+    }
   }
 }
 
@@ -217,15 +229,53 @@ VisualUrl::VisualUrl(const VisualUrl& url)
   mType(url.mType),
   mLocation(url.mLocation)
 {
+  if(VisualUrl::TEXTURE == mLocation)
+  {
+    Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
+    if(factory)
+    {
+      GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
+    }
+  }
+}
+
+VisualUrl::~VisualUrl()
+{
+  if(VisualUrl::TEXTURE == mLocation)
+  {
+    Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
+    if(factory)
+    {
+      GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
+    }
+  }
 }
 
 VisualUrl& VisualUrl::operator=(const VisualUrl& url)
 {
   if(&url != this)
   {
+    if(VisualUrl::TEXTURE == mLocation)
+    {
+      Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
+      if(factory)
+      {
+        GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
+      }
+    }
+
     mUrl      = url.mUrl;
     mType     = url.mType;
     mLocation = url.mLocation;
+
+    if(VisualUrl::TEXTURE == mLocation)
+    {
+      Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
+      if(factory)
+      {
+        GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
+      }
+    }
   }
   return *this;
 }
@@ -257,12 +307,7 @@ bool VisualUrl::IsLocalResource() const
 
 std::string VisualUrl::GetLocation() const
 {
-  const auto location = mUrl.find("://");
-  if(std::string::npos != location)
-  {
-    return mUrl.substr(location + 3u); // 3 characters forwards from the start of ://
-  }
-  return mUrl;
+  return GetLocation(mUrl);
 }
 
 std::string VisualUrl::CreateTextureUrl(const std::string& location)
@@ -270,6 +315,22 @@ std::string VisualUrl::CreateTextureUrl(const std::string& location)
   return "dali://" + location;
 }
 
+VisualUrl::ProtocolType VisualUrl::GetProtocolType(const std::string& url)
+{
+  return ResolveLocation(url);
+}
+
+std::string VisualUrl::GetLocation(const std::string& url)
+{
+  const auto location = url.find("://");
+  if(std::string::npos != location)
+  {
+    return url.substr(location + 3u); // 3 characters forwards from the start of ://
+  }
+  return url;
+}
+
+
 } // namespace Internal
 
 } // namespace Toolkit
index 8857184..a772bd1 100644 (file)
@@ -55,8 +55,16 @@ public:
   VisualUrl();
 
   /**
+   * Default Destructor.
+   * Delete an external texture if if protocolType is TEXTURE.
+   */
+  ~VisualUrl();
+
+  /**
    * Constructor.
    * Determines type of visual and whether the url is local or remote
+   * Notify that it is using an external texture if if protocolType is TEXTURE.
+   *
    * @param[in] url The URL to store and resolve
    */
   VisualUrl(const std::string& url);
@@ -114,6 +122,19 @@ public:
    */
   static std::string CreateTextureUrl(const std::string& location);
 
+  /**
+   * Helper to get a ProtocolType from url
+   * @param url the url of the texture
+   * @return the protocol type
+   */
+  static VisualUrl::ProtocolType GetProtocolType(const std::string& url);
+
+  /**
+   * Helper to get a location from url
+   * @param url the location of the texture
+   * @return the location
+   */
+  static std::string GetLocation(const std::string& url);
 private:
   std::string  mUrl;
   Type         mType;
index 1ff27f1..eefc529 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 = 35;
+const unsigned int TOOLKIT_MICRO_VERSION = 36;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 15e202b..212dba7 100644 (file)
@@ -28,6 +28,7 @@ SET( public_api_src_files
   ${public_api_src_dir}/controls/video-view/video-view.cpp
   ${public_api_src_dir}/controls/camera-view/camera-view.cpp
   ${public_api_src_dir}/image-loader/image.cpp
+  ${public_api_src_dir}/image-loader/image-url.cpp
   ${public_api_src_dir}/image-loader/async-image-loader.cpp
   ${public_api_src_dir}/image-loader/sync-image-loader.cpp
   ${public_api_src_dir}/styling/style-manager.cpp
@@ -84,6 +85,7 @@ SET( public_api_item_view_header_files
 
 SET( public_api_image_loader_header_files
   ${public_api_src_dir}/image-loader/image.h
+  ${public_api_src_dir}/image-loader/image-url.h
   ${public_api_src_dir}/image-loader/async-image-loader.h
   ${public_api_src_dir}/image-loader/sync-image-loader.h
 )
diff --git a/dali-toolkit/public-api/image-loader/image-url.cpp b/dali-toolkit/public-api/image-loader/image-url.cpp
new file mode 100644 (file)
index 0000000..65b9601
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/public-api/image-loader/image-url.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/image-loader/image-url-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+ImageUrl::ImageUrl()
+{
+}
+
+ImageUrl::~ImageUrl()
+{
+}
+
+ImageUrl ImageUrl::New(Texture& texture)
+{
+  Toolkit::Internal::ImageUrlPtr internal = Toolkit::Internal::ImageUrl::New(texture);
+  return ImageUrl(internal.Get());
+}
+
+ImageUrl ImageUrl::DownCast(BaseHandle handle)
+{
+  return ImageUrl(dynamic_cast<Toolkit::Internal::ImageUrl*>(handle.GetObjectPtr()));
+}
+
+ImageUrl::ImageUrl(const ImageUrl& rhs) = default;
+
+ImageUrl& ImageUrl::operator=(const ImageUrl& url) = default;
+
+ImageUrl::ImageUrl(ImageUrl&& rhs) = default;
+
+ImageUrl& ImageUrl::operator=(ImageUrl&& rhs) = default;
+
+const std::string& ImageUrl::GetUrl() const
+{
+  return GetImpl(*this).GetUrl();
+}
+
+ImageUrl::ImageUrl(Toolkit::Internal::ImageUrl* internal)
+: BaseHandle(internal)
+{
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/public-api/image-loader/image-url.h b/dali-toolkit/public-api/image-loader/image-url.h
new file mode 100644 (file)
index 0000000..819198b
--- /dev/null
@@ -0,0 +1,122 @@
+#ifndef DALI_TOOLKIT_IMAGE_URL_H
+#define DALI_TOOLKIT_IMAGE_URL_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/public-api/rendering/texture.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal DALI_INTERNAL
+{
+class ImageUrl;
+}
+/**
+ * @brief ImageUrl can be used to wrap an external buffer.
+ *
+ * An instance of ImageUrl can be created from Image::GenerateUrl().
+ * Application can get url from ImageUrl.
+ * When application does not use this anymore, the destructor of the ImageUrl is called.
+ * At this time, the buffer is deleted from the texture manager.
+ */
+class DALI_TOOLKIT_API ImageUrl : public BaseHandle
+{
+public:
+  /**
+   * Default Constructor.
+   * Resulting URL is not valid
+   */
+  ImageUrl();
+
+  /**
+   * Destructor
+   */
+  ~ImageUrl();
+
+  /**
+   * @brief Create an initialized ImageUrl.
+   *
+   * @param[in] texture The texture url is got from external buffer.
+   * @return A handle to a newly allocated Dali resource.
+   */
+  static ImageUrl New(Texture& texture);
+
+  /**
+   * @brief Downcast an Object handle to ImageUrl handle.
+   *
+   * If handle points to a ImageUrl object the downcast produces valid
+   * handle. If not the returned handle is left uninitialized.
+   *
+   * @param[in] handle to An object.
+   * @return handle to a ImageUrl object or an uninitialized handle.
+   */
+  static ImageUrl DownCast(BaseHandle handle);
+
+  /**
+   * Copy constructor
+   * @param[in] url The url to copy
+   */
+  ImageUrl(const ImageUrl& url);
+
+  /**
+   * Assignment operator
+   * @param[in] url The url to copy
+   */
+  ImageUrl& operator=(const ImageUrl& url);
+
+  /**
+   * @brief Move constructor.
+   * @param[in] rhs A reference to the moved handle
+   */
+  ImageUrl(ImageUrl&& rhs);
+
+  /**
+   * @brief Move assignment operator.
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this handle
+   */
+  ImageUrl& operator=(ImageUrl&& rhs);
+
+  /**
+   * Get the url
+   * @return Returns url's string
+   */
+  const std::string& GetUrl() const;
+
+public: // Not intended for application developers
+  /// @cond internal
+  /**
+   * @brief This constructor is used by New() methods.
+   *
+   * @param[in] internal A pointer to a newly allocated Dali resource.
+   */
+  explicit DALI_INTERNAL ImageUrl(Toolkit::Internal::ImageUrl* internal);
+  /// @endcond
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif /* DALI_TOOLKIT_IMAGE_URL_H */
index 2dc20c8..b44061e 100644 (file)
@@ -19,6 +19,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/image-loader/texture-manager.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/rendering/frame-buffer-devel.h>
@@ -29,30 +30,34 @@ namespace Toolkit
 {
 namespace Image
 {
-std::string GenerateUrl(Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height)
+Dali::Toolkit::ImageUrl GenerateUrl(Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height)
 {
   Texture texture = Texture::New(Dali::TextureType::TEXTURE_2D, pixelFormat, width, height);
   frameBuffer.AttachColorTexture(texture, 0u, 0u);
-  return Dali::Toolkit::TextureManager::AddTexture(texture);
+  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+  return imageUrl;
 }
 
-std::string GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index)
+Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index)
 {
   Texture texture = Dali::DevelFrameBuffer::GetColorTexture(frameBuffer, index);
-  return Dali::Toolkit::TextureManager::AddTexture(texture);
+  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+  return imageUrl;
 }
 
-std::string GenerateUrl(const Dali::PixelData pixelData)
+Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData)
 {
   Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight());
   texture.Upload(pixelData);
-  return Dali::Toolkit::TextureManager::AddTexture(texture);
+  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+  return imageUrl;
 }
 
-std::string GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource)
+Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource)
 {
   Texture texture = Dali::Texture::New(*nativeImageSource);
-  return Dali::Toolkit::TextureManager::AddTexture(texture);
+  Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+  return imageUrl;
 }
 
 } // namespace Image
index 6fb2816..ad2f56e 100644 (file)
@@ -24,6 +24,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/dali-toolkit-common.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
 
 namespace Dali
 {
@@ -44,9 +45,9 @@ namespace Image
  * @param[in] pixelFormat the pixel format for this frame buffer
  * @param[in] width the width for this frame buffer
  * @param[in] height the height for this frame buffer
- * @return the Url string representing this frame buffer
+ * @return the ImageUrl representing this frame buffer
  */
-DALI_TOOLKIT_API std::string GenerateUrl(const Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height);
 
 /**
  * @brief Generate a Url from frame buffer.
@@ -55,27 +56,27 @@ DALI_TOOLKIT_API std::string GenerateUrl(const Dali::FrameBuffer frameBuffer, Pi
  * This method does not check for duplicates, If same frame buffer is entered multiple times, a different URL is returned each time.
  * @param[in] frameBuffer the frame buffer to converted to Url
  * @param[in] index the index of the attached color texture.
- * @return the Url string representing this frame buffer
+ * @return the ImageUrl representing this frame buffer
  */
-DALI_TOOLKIT_API std::string GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index);
 
 /**
  * @brief Generate a Url from Pixel data.
  * This Url can be used in visuals to render the pixel data.
  * @note This method does not check for duplicates, If same pixel data is entered multiple times, a different URL is returned each time.
  * @param[in] pixelData the pixel data to converted to Url
- * @return the Url string representing this pixel data
+ * @return the ImageUrl representing this pixel data
  */
-DALI_TOOLKIT_API std::string GenerateUrl(const Dali::PixelData pixelData);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData);
 
 /**
  * @brief Generate a Url from native image source.
  * This Url can be used in visuals to render the native image source.
  * @note This method does not check for duplicates, If same native image source is entered multiple times, a different URL is returned each time.
  * @param[in] nativeImageSource the native image source to converted to Url
- * @return the Url string representing this native image source
+ * @return the ImageUrl representing this native image source
  */
-DALI_TOOLKIT_API std::string GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource);
 
 } // namespace Image
 
index 635dc28..d3df7ab 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.0.35
+Version:    2.0.36
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT