[dali_1.4.24] Merge branch 'devel/master' 78/207978/1
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Fri, 14 Jun 2019 10:37:41 +0000 (11:37 +0100)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Fri, 14 Jun 2019 10:37:41 +0000 (11:37 +0100)
Change-Id: Ibf32e5a968bb1791519044e501b4e23081ae59cd

24 files changed:
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
automated-tests/src/dali-toolkit-styling/CMakeLists.txt
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.h [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h [new file with mode: 0644]
dali-toolkit/devel-api/image-loader/async-image-loader-devel.cpp
dali-toolkit/devel-api/image-loader/async-image-loader-devel.h
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/async-image-loader-impl.cpp
dali-toolkit/internal/image-loader/async-image-loader-impl.h
dali-toolkit/internal/image-loader/image-atlas-impl.cpp
dali-toolkit/internal/image-loader/image-load-thread.cpp
dali-toolkit/internal/image-loader/image-load-thread.h
dali-toolkit/internal/visuals/texture-manager-impl.cpp
dali-toolkit/internal/visuals/texture-manager-impl.h
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/public-api/image-loader/async-image-loader.cpp
packaging/dali-toolkit.spec

index bd7def3..1754324 100755 (executable)
@@ -41,6 +41,7 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-environment-variable.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp
@@ -48,6 +49,7 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
index f956e18..58225f0 100644 (file)
@@ -23,6 +23,7 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-file-loader.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-native-image-source.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
@@ -35,6 +36,7 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-video-player.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-virtual-keyboard.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
index 993601c..2e0a4f9 100755 (executable)
@@ -82,6 +82,7 @@ LIST(APPEND TC_SOURCES
   dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
   dali-toolkit-test-utils/toolkit-environment-variable.cpp
   dali-toolkit-test-utils/toolkit-input-method-context.cpp
+  dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
   dali-toolkit-test-utils/toolkit-orientation.cpp
   dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
   dali-toolkit-test-utils/toolkit-style-monitor.cpp
@@ -92,6 +93,7 @@ LIST(APPEND TC_SOURCES
   dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
   dali-toolkit-test-utils/toolkit-video-player.cpp
   dali-toolkit-test-utils/toolkit-web-engine.cpp
+  dali-toolkit-test-utils/toolkit-window.cpp
   dali-toolkit-test-utils/toolkit-trigger-event-factory.cpp
   dali-toolkit-test-utils/dali-test-suite-utils.cpp
   dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
index b5bab83..e49b358 100644 (file)
@@ -25,6 +25,9 @@ namespace Dali
 class EglInterface;
 class DisplayConnection;
 class ThreadSynchronizationInterface;
+class Window;
+
+using WindowContainer = std::vector<Window>;
 
 namespace Internal
 {
@@ -59,9 +62,13 @@ public:
 
 public:
   static Dali::RenderSurfaceInterface& GetSurface();
+  static Dali::WindowContainer GetWindows();
   static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
+  static Dali::Adaptor::WindowCreatedSignalType& WindowCreatedSignal();
   static bool mAvailable;
   static Vector<CallbackBase*> mCallbacks;
+  static Dali::WindowContainer mWindows;
+  static Dali::Adaptor::WindowCreatedSignalType* mWindowCreatedSignal;
 };
 
 } // namespace Adaptor
index c980501..522537c 100644 (file)
  *
  */
 
-// CLASS HEADER
+#include <toolkit-window.h>
+
+// Don't want to include the actual window.h which otherwise will be indirectly included by adaptor.h.
+#define DALI_WINDOW_H
 #include <dali/integration-api/adaptors/adaptor.h>
+
 #include <dali/integration-api/adaptors/scene-holder.h>
 
 #include <dali/public-api/object/base-object.h>
@@ -36,6 +40,8 @@ namespace Adaptor
 
 bool Adaptor::mAvailable = false;
 Vector<CallbackBase*> Adaptor::mCallbacks = Vector<CallbackBase*>();
+Dali::WindowContainer Adaptor::mWindows;
+Dali::Adaptor::WindowCreatedSignalType* Adaptor::mWindowCreatedSignal = nullptr;
 
 Dali::Adaptor& Adaptor::Get()
 {
@@ -50,12 +56,27 @@ Dali::RenderSurfaceInterface& Adaptor::GetSurface()
   return *renderSurface;
 }
 
+Dali::WindowContainer Adaptor::GetWindows()
+{
+  return Adaptor::mWindows;
+}
+
 Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal()
 {
   Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType;
   return *signal;
 }
 
+Dali::Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
+{
+  if ( !Adaptor::mWindowCreatedSignal )
+  {
+    Adaptor::mWindowCreatedSignal = new Dali::Adaptor::WindowCreatedSignalType;
+  }
+
+  return *Adaptor::mWindowCreatedSignal;
+}
+
 } // namespace Adaptor
 } // namespace Internal
 
@@ -169,11 +190,21 @@ Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
   return Internal::Adaptor::Adaptor::AdaptorSignal();
 }
 
+Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
+{
+  return Internal::Adaptor::Adaptor::WindowCreatedSignal();
+}
+
 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
 {
   return Internal::Adaptor::Adaptor::GetSurface();
 }
 
+Dali::WindowContainer Adaptor::GetWindows() const
+{
+  return Internal::Adaptor::Adaptor::GetWindows();
+}
+
 Any Adaptor::GetNativeWindowHandle()
 {
   Any window;
@@ -256,6 +287,12 @@ const LogFactoryInterface& Adaptor::GetLogFactory()
 Adaptor::Adaptor()
 : mImpl( NULL )
 {
+  Dali::PositionSize win_size;
+  win_size.width = 640;
+  win_size.height = 800;
+
+  Dali::Window window = Dali::Window::New( win_size, "" );
+  Internal::Adaptor::Adaptor::mWindows.push_back( window );
 }
 
 } // namespace Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
new file mode 100644 (file)
index 0000000..1e29a1c
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2018 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 "toolkit-lifecycle-controller.h"
+
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+namespace Dali
+{
+
+/********************************************************************************
+ * Stub for Dali::Internal::Adaptor::LifecycleController
+ ********************************************************************************/
+namespace Internal
+{
+namespace Adaptor
+{
+class LifecycleController : public BaseObject
+{
+public: // Creation & Destruction
+
+  LifecycleController();
+  ~LifecycleController();
+  static Dali::LifecycleController Get();
+
+
+public: // Signals
+  Dali::LifecycleController::LifecycleSignalType& InitSignal();
+
+private:
+  Dali::LifecycleController::LifecycleSignalType mInitSignal;
+  static Dali::LifecycleController mLifecycleController;
+};
+
+Dali::LifecycleController LifecycleController::mLifecycleController;
+
+LifecycleController::LifecycleController()
+{
+}
+
+LifecycleController::~LifecycleController()
+{
+}
+
+Dali::LifecycleController LifecycleController::Get()
+{
+  if( ! mLifecycleController )
+  {
+    mLifecycleController = Dali::LifecycleController(new Internal::Adaptor::LifecycleController());
+  }
+  return mLifecycleController;
+}
+
+Dali::LifecycleController::LifecycleSignalType& LifecycleController::InitSignal()
+{
+  return mInitSignal;
+}
+
+} // namespace Adaptor
+} // namespace Internal
+
+
+/********************************************************************************
+ * Stub for Dali::LifecycleController
+ ********************************************************************************/
+
+LifecycleController::LifecycleController(){}
+LifecycleController::~LifecycleController(){}
+
+LifecycleController LifecycleController::Get()
+{
+  // Get the physical keyboard handle
+  LifecycleController handle = Internal::Adaptor::LifecycleController::Get();
+  return handle;
+}
+
+LifecycleController::LifecycleSignalType& LifecycleController::InitSignal()
+{
+  BaseObject& object = GetBaseObject();
+  Internal::Adaptor::LifecycleController& controller = static_cast< Internal::Adaptor::LifecycleController& >( object );
+  return controller.InitSignal();
+}
+
+LifecycleController::LifecycleController( Internal::Adaptor::LifecycleController *impl )
+: BaseHandle(impl)
+{
+}
+
+} // namespace Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.h
new file mode 100644 (file)
index 0000000..3069b15
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef TOOLKIT_LIFECYCLE_CONTROLLER_H
+#define TOOLKIT_LIFECYCLE_CONTROLLER_H
+
+/*
+ * Copyright (c) 2019 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/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class LifecycleController;
+}
+}
+
+class LifecycleController : public BaseHandle
+{
+public:
+  typedef Signal< void (void) > LifecycleSignalType;
+  LifecycleController();
+  ~LifecycleController();
+  static LifecycleController Get();
+  LifecycleSignalType& InitSignal();
+  LifecycleController( Internal::Adaptor::LifecycleController* impl );
+};
+
+
+} // namespace Dali
+
+#endif // TOOLKIT_LIFECYCLE_CONTROLLER_H
index 1b576bc..de2d0c4 100644 (file)
@@ -24,6 +24,7 @@
 #include <dali/integration-api/adaptors/adaptor.h>
 #include <toolkit-adaptor-impl.h>
 #include <toolkit-singleton-service.h>
+#include <toolkit-lifecycle-controller.h>
 
 namespace Dali
 {
@@ -50,6 +51,19 @@ public:
     {
       fontClient.SetDpi( mDpi.x, mDpi.y );
     }
+
+    bool isAdaptorAvailable = Dali::Internal::Adaptor::Adaptor::Get().IsAvailable();
+    if ( isAdaptorAvailable )
+    {
+      Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
+      lifecycleController.InitSignal().Emit();
+
+      Dali::Window window = Dali::Internal::Adaptor::Adaptor::mWindows.front();
+      if ( window )
+      {
+        Dali::Internal::Adaptor::Adaptor::WindowCreatedSignal().Emit( window );
+      }
+    }
   }
 
   ~ToolkitTestApplication()
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
new file mode 100644 (file)
index 0000000..05c4836
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2019 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/actors/actor.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include "toolkit-window.h"
+
+namespace Dali
+{
+
+class Window;
+
+/********************************************************************************
+ * Stub for Dali::Internal::Adaptor::Window
+ ********************************************************************************/
+
+namespace Internal
+{
+namespace Adaptor
+{
+
+class Window : public Dali::BaseObject
+{
+public:
+
+  Window()
+  {
+  }
+
+  virtual ~Window()
+  {
+  }
+
+  static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
+  {
+    return new Window();
+  }
+
+  static Dali::Window Get( Dali::Actor actor )
+  {
+    return Dali::Window();
+  }
+};
+
+} // Adaptor
+} // Internal
+
+Window::Window()
+{
+}
+
+Window::~Window()
+{
+}
+
+Dali::Window Window::New( PositionSize windowPosition, const std::string& name, bool isTransparent )
+{
+  Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, "", isTransparent );
+  return Window( window );
+}
+
+Dali::Window Window::New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent )
+{
+  Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, className, isTransparent );
+  return Window( window );
+}
+
+Dali::Layer Window::GetRootLayer() const
+{
+  return Dali::Stage::GetCurrent().GetRootLayer();
+}
+
+Window::Window( Internal::Adaptor::Window* window )
+: BaseHandle( window )
+{
+}
+
+namespace DevelWindow
+{
+
+Window Get( Actor actor )
+{
+  return Internal::Adaptor::Window::Get( actor );
+}
+
+KeyEventSignalType& KeyEventSignal( Window window )
+{
+  return Dali::Stage::GetCurrent().KeyEventSignal();
+}
+
+TouchSignalType& TouchSignal( Window window )
+{
+  return Dali::Stage::GetCurrent().TouchSignal();
+}
+
+} // namespace DevelWindow
+
+} // Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h
new file mode 100644 (file)
index 0000000..4c95ad7
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef TOOLKIT_WINDOW_H
+#define TOOLKIT_WINDOW_H
+
+/*
+ * Copyright (c) 2019 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/math/rect.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+namespace Dali
+{
+
+class Actor;
+class Layer;
+class KeyEvent;
+class TouchData;
+
+typedef Dali::Rect<int> PositionSize;
+
+namespace Internal
+{
+namespace Adaptor
+{
+class Window;
+}
+}
+
+class Window : public BaseHandle
+{
+public:
+
+  static Window New(PositionSize windowPosition, const std::string& name, bool isTransparent = false);
+  static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
+  Window();
+  ~Window();
+  Window(const Window& handle);
+  Window& operator=(const Window& rhs);
+  Layer GetRootLayer() const;
+
+public:
+  explicit Window( Internal::Adaptor::Window* window );
+};
+
+namespace DevelWindow
+{
+
+typedef Signal< void (const KeyEvent&) > KeyEventSignalType;
+typedef Signal< void (const TouchData&) > TouchSignalType;
+
+Dali::Window Get( Actor actor );
+KeyEventSignalType& KeyEventSignal( Dali::Window window );
+TouchSignalType& TouchSignal( Dali::Window window );
+
+}
+
+} // namespace Dali
+
+#endif // TOOLKIT_WINDOW_H
index 690f078..451ace3 100644 (file)
@@ -24,6 +24,17 @@ namespace Toolkit
 namespace DevelAsyncImageLoader
 {
 
+uint32_t Load( AsyncImageLoader asyncImageLoader,
+               const std::string& url,
+               ImageDimensions dimensions,
+               FittingMode::Type fittingMode,
+               SamplingMode::Type samplingMode,
+               bool orientationCorrection,
+               DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad )
+{
+  return GetImplementation( asyncImageLoader ).Load( Toolkit::Internal::VisualUrl(url), dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad);
+}
+
 PixelBufferLoadedSignalType& PixelBufferLoadedSignal( AsyncImageLoader asyncImageLoader )
 {
   return GetImplementation( asyncImageLoader ).PixelBufferLoadedSignal();
index 7cb64c5..1208f0d 100644 (file)
@@ -31,6 +31,36 @@ namespace DevelAsyncImageLoader
 typedef Signal< void ( uint32_t, Devel::PixelBuffer ) > PixelBufferLoadedSignalType;
 
 /**
+ * @brief Whether to multiply alpha into color channels on load
+ */
+enum class PreMultiplyOnLoad
+{
+  OFF = 0, ///< Don't modify the image
+  ON           ///< Multiply alpha into color channels on load
+};
+
+/**
+ * @brief Starts an image loading task.
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
+ * @param[in] asyncImageLoader The ayncImageLoader
+ * @param[in] url The URL of the image file to load
+ * @param[in] dimensions The width and height to fit the loaded image to
+ * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter
+ * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size
+ * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header
+ * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha
+ * @return The loading task id
+ */
+DALI_TOOLKIT_API uint32_t Load(  AsyncImageLoader asyncImageLoader,
+                const std::string& url,
+                ImageDimensions dimensions,
+                FittingMode::Type fittingMode,
+                SamplingMode::Type samplingMode,
+                bool orientationCorrection,
+                DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
+
+/**
  * Connect to this signal if you want to load a PixelBuffer instead of a PixelData.
  * @note Connecting to this signal prevents the emission of the ImageLoadedSignal.
  */
index 3653f5f..5e447c4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -23,6 +23,8 @@
 #include <dali/public-api/actors/layer.h>
 #include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
 #include <dali/devel-api/adaptor-framework/singleton-service.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
+#include <dali/devel-api/adaptor-framework/lifecycle-controller.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/events/key-event.h>
@@ -31,6 +33,7 @@
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/public-api/object/property-map.h>
 #include <dali/public-api/images/resource-image.h>
+#include <dali/integration-api/adaptors/adaptor.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -130,8 +133,31 @@ KeyboardFocusManager::KeyboardFocusManager()
   mCustomAlgorithmInterface(NULL)
 {
   // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorShown.
-  Stage::GetCurrent().KeyEventSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
-  Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch );
+
+  LifecycleController::Get().InitSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnAdaptorInit );
+}
+
+void KeyboardFocusManager::OnAdaptorInit()
+{
+  if( Adaptor::IsAvailable() )
+  {
+    // Retrieve all the existing widnows
+    Dali::WindowContainer windows = Adaptor::Get().GetWindows();
+    for ( auto iter = windows.begin(); iter != windows.end(); ++iter )
+    {
+      DevelWindow::KeyEventSignal( *iter ).Connect( mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
+      DevelWindow::TouchSignal( *iter ).Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch);
+    }
+
+    // Get notified when any new window is created afterwards
+    Adaptor::Get().WindowCreatedSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnWindowCreated);
+  }
+}
+
+void KeyboardFocusManager::OnWindowCreated( Dali::Window& window )
+{
+  DevelWindow::KeyEventSignal( window ).Connect( mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
+  DevelWindow::TouchSignal( window ).Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch);
 }
 
 KeyboardFocusManager::~KeyboardFocusManager()
@@ -298,10 +324,11 @@ bool KeyboardFocusManager::IsLayoutControl(Actor actor) const
 Toolkit::Control KeyboardFocusManager::GetParentLayoutControl(Actor actor) const
 {
   // Get the actor's parent layout control that supports two dimensional keyboard navigation
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor;
   Actor parent;
   if(actor)
   {
+    rootActor = DevelWindow::Get( actor ).GetRootLayer();
     parent = actor.GetParent();
   }
 
@@ -383,7 +410,7 @@ bool KeyboardFocusManager::MoveFocus(Toolkit::Control::KeyboardFocus::Direction
 
           if( !nextFocusableActor )
           {
-            nextFocusableActor = Stage::GetCurrent().GetRootLayer().FindChildById( actorId );
+            nextFocusableActor = DevelWindow::Get( currentFocusActor ).GetRootLayer().FindChildById( actorId );
           }
         }
       }
index 0e0f867..967e9e1 100644 (file)
@@ -30,6 +30,8 @@
 namespace Dali
 {
 
+class Window;
+
 namespace Toolkit
 {
 
@@ -39,7 +41,7 @@ namespace Internal
 /**
  * @copydoc Toolkit::KeyboardFocusManager
  */
-class KeyboardFocusManager : public Dali::BaseObject
+class KeyboardFocusManager : public Dali::BaseObject, public ConnectionTracker
 {
 public:
 
@@ -176,6 +178,17 @@ private:
   typedef FocusStack::iterator FocusStackIterator; ///< Define FocusStack::Iterator as FocusStackIterator to navigate FocusStack
 
   /**
+   * This will be called when the adaptor is initialized
+   */
+  void OnAdaptorInit();
+
+  /**
+   * This will be called when a new wndow is created
+   * @param window The new window
+   */
+  void OnWindowCreated( Dali::Window& window );
+
+  /**
    * Get configuration from StyleManager.
    */
   void GetConfigurationFromStyleManger();
index 966da79..1b764cb 100644 (file)
@@ -53,15 +53,15 @@ uint32_t AsyncImageLoader::Load( const VisualUrl& url,
                                  ImageDimensions dimensions,
                                  FittingMode::Type fittingMode,
                                  SamplingMode::Type samplingMode,
-                                 bool orientationCorrection )
+                                 bool orientationCorrection,
+                                 DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad)
 {
   if( !mIsLoadThreadStarted )
   {
     mLoadThread.Start();
     mIsLoadThreadStarted = true;
   }
-
-  mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, url, dimensions, fittingMode, samplingMode, orientationCorrection ) );
+  mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, url, dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad ) );
 
   return mLoadTaskId;
 }
index ce40f5a..7810a8f 100644 (file)
@@ -50,13 +50,14 @@ public:
   static IntrusivePtr<AsyncImageLoader> New();
 
   /**
-   * @copydoc Toolkit::AsyncImageLoader::Load( const std::string&, ImageDimensions, FittingMode::Type, SamplingMode::Type, bool )
+   * @copydoc Toolkit::AsyncImageLoader::Load( const std::string&, ImageDimensions, FittingMode::Type, SamplingMode::Type, bool , DevelAsyncImageLoader::PreMultiplyOnLoad )
    */
   uint32_t Load( const VisualUrl& url,
                  ImageDimensions dimensions,
                  FittingMode::Type fittingMode,
                  SamplingMode::Type samplingMode,
-                 bool orientationCorrection );
+                 bool orientationCorrection,
+                 DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
 
   /**
    * @copydoc Toolkit::AsyncImageLoader::ImageLoadedSignal
index b69adbd..d167499 100644 (file)
@@ -163,7 +163,7 @@ bool ImageAtlas::Upload( Vector4& textureRect,
   unsigned int packPositionY = 0;
   if( mPacker.Pack( dimensions.GetWidth(), dimensions.GetHeight(), packPositionX, packPositionY ) )
   {
-    unsigned short loadId = mAsyncLoader.Load( url, size, fittingMode, SamplingMode::BOX_THEN_LINEAR, orientationCorrection );
+    unsigned short loadId = mAsyncLoader.Load( url, size, fittingMode, SamplingMode::BOX_THEN_LINEAR, orientationCorrection);
     mLoadingTaskInfoContainer.PushBack( new LoadingTaskInfo( loadId, packPositionX, packPositionY, dimensions.GetWidth(), dimensions.GetHeight(), atlasUploadObserver ) );
     // apply the half pixel correction
     textureRect.x = ( static_cast<float>( packPositionX ) +0.5f ) / mWidth; // left
index 74d3e39..320911d 100644 (file)
@@ -33,14 +33,15 @@ namespace Internal
 {
 
 LoadingTask::LoadingTask( uint32_t id, const VisualUrl& url, ImageDimensions dimensions,
-                          FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection )
+                          FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad )
 : pixelBuffer(),
   url( url ),
   id( id ),
   dimensions( dimensions ),
   fittingMode( fittingMode ),
   samplingMode( samplingMode ),
-  orientationCorrection( orientationCorrection )
+  orientationCorrection( orientationCorrection ),
+  preMultiplyOnLoad( preMultiplyOnLoad )
 {
 }
 
@@ -54,6 +55,14 @@ void LoadingTask::Load()
   {
     pixelBuffer = Dali::DownloadImageSynchronously ( url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection );
   }
+
+  if( pixelBuffer && Pixel::HasAlpha( pixelBuffer.GetPixelFormat() ) )
+  {
+    if( preMultiplyOnLoad == DevelAsyncImageLoader::PreMultiplyOnLoad::ON )
+    {
+      pixelBuffer.MultiplyColorByAlpha();
+    }
+  }
 }
 
 
index 4791a75..35fe216 100644 (file)
@@ -28,6 +28,7 @@
 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
 #include <dali/integration-api/adaptors/log-factory-interface.h>
 #include <dali-toolkit/internal/visuals/visual-url.h>
+#include <dali-toolkit/devel-api/image-loader/async-image-loader-devel.h>
 
 namespace Dali
 {
@@ -51,10 +52,12 @@ struct LoadingTask
    * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
    * @param [in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size.
    * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
+   * @param [in] preMultiplyOnLoad ON if the image's color should be multiplied by it's alpha.
    */
   LoadingTask( uint32_t id, const VisualUrl& url, ImageDimensions dimensions,
                FittingMode::Type fittingMode, SamplingMode::Type samplingMode,
-               bool orientationCorrection );
+               bool orientationCorrection,
+               DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
 
   /**
    * Load the image
@@ -78,7 +81,7 @@ public:
   FittingMode::Type  fittingMode;   ///< fitting options
   SamplingMode::Type samplingMode;  ///< sampling options
   bool               orientationCorrection:1; ///< if orientation correction is needed
-
+  DevelAsyncImageLoader::PreMultiplyOnLoad            preMultiplyOnLoad; //< if the image's color should be multiplied by it's alpha
 };
 
 
index 3a32ddc..2be3aaa 100644 (file)
@@ -690,10 +690,12 @@ void TextureManager::LoadTexture( TextureInfo& textureInfo, TextureUploadObserve
   {
     auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders;
     auto loadingHelperIt = loadersContainer.GetNext();
+    auto premultiplyOnLoad = textureInfo.preMultiplyOnLoad? DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF;
     DALI_ASSERT_ALWAYS(loadingHelperIt != loadersContainer.End());
     loadingHelperIt->Load(textureInfo.textureId, textureInfo.url,
                           textureInfo.desiredSize, textureInfo.fittingMode,
-                          textureInfo.samplingMode, textureInfo.orientationCorrection );
+                          textureInfo.samplingMode, textureInfo.orientationCorrection,
+                          premultiplyOnLoad );
   }
   ObserveTexture( textureInfo, observer );
 }
@@ -873,13 +875,8 @@ void TextureManager::UploadTexture( Devel::PixelBuffer& pixelBuffer, TextureInfo
   {
     DALI_LOG_INFO( gTextureManagerLogFilter, Debug::General, "  TextureManager::UploadTexture() New Texture for textureId:%d\n", textureInfo.textureId );
 
-    // If the texture doesn't have an alpha channel, can't pre-multiply it.
-    // Ensure that we don't change the load parameter (it's used for hashing), and instead set
-    // the status for use in the observer.
-    auto preMultiply = textureInfo.preMultiplyOnLoad ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD :
-      TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
-    PreMultiply( pixelBuffer, preMultiply );
-    textureInfo.preMultiplied = (preMultiply == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD );
+    // Check if this pixelBuffer is premultiplied
+    textureInfo.preMultiplied = pixelBuffer.IsAlphaPreMultiplied();
 
     Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, pixelBuffer.GetPixelFormat(),
                                     pixelBuffer.GetWidth(), pixelBuffer.GetHeight() );
@@ -1120,10 +1117,11 @@ void TextureManager::AsyncLoadingHelper::Load(TextureId          textureId,
                                               ImageDimensions    desiredSize,
                                               FittingMode::Type  fittingMode,
                                               SamplingMode::Type samplingMode,
-                                              bool               orientationCorrection)
+                                              bool               orientationCorrection,
+                                              DevelAsyncImageLoader::PreMultiplyOnLoad  preMultiplyOnLoad)
 {
   mLoadingInfoContainer.push_back(AsyncLoadingInfo(textureId));
-  auto id = mLoader.Load(url.GetUrl(), desiredSize, fittingMode, samplingMode, orientationCorrection);
+  auto id = DevelAsyncImageLoader::Load(mLoader, url.GetUrl(), desiredSize, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad);
   mLoadingInfoContainer.back().loadId = id;
 }
 
index c64b781..2cb06bd 100755 (executable)
@@ -713,13 +713,15 @@ private:
      * @param[in] samplingMode          The SamplingMode to use
      * @param[in] orientationCorrection Whether to use image metadata to rotate or flip the image,
      *                                  e.g., from portrait to landscape
+     * @param[in] preMultiplyOnLoad     if the image's color should be multiplied by it's alpha.
      */
     void Load(TextureId textureId,
               const VisualUrl& url,
               ImageDimensions desiredSize,
               FittingMode::Type fittingMode,
               SamplingMode::Type samplingMode,
-              bool orientationCorrection);
+              bool orientationCorrection,
+              DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
 
   public:
     AsyncLoadingHelper(const AsyncLoadingHelper&) = delete;
index e9c1a6a..1aff4b3 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 4;
-const unsigned int TOOLKIT_MICRO_VERSION = 23;
+const unsigned int TOOLKIT_MICRO_VERSION = 24;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index b01134d..a1d21e7 100644 (file)
@@ -64,12 +64,12 @@ AsyncImageLoader AsyncImageLoader::New()
 
 uint32_t AsyncImageLoader::Load( const std::string& url )
 {
-  return GetImplementation( *this ).Load( Toolkit::Internal::VisualUrl(url), ImageDimensions(), FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true );
+  return GetImplementation( *this ).Load( Toolkit::Internal::VisualUrl(url), ImageDimensions(), FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true, DevelAsyncImageLoader::PreMultiplyOnLoad::OFF );
 }
 
 uint32_t AsyncImageLoader::Load( const std::string& url, ImageDimensions dimensions )
 {
-  return GetImplementation( *this ).Load( Toolkit::Internal::VisualUrl(url), dimensions, FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true );
+  return GetImplementation( *this ).Load( Toolkit::Internal::VisualUrl(url), dimensions, FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true , DevelAsyncImageLoader::PreMultiplyOnLoad::OFF );
 }
 
 uint32_t AsyncImageLoader::Load( const std::string& url,
@@ -78,7 +78,7 @@ uint32_t AsyncImageLoader::Load( const std::string& url,
                                  SamplingMode::Type samplingMode,
                                  bool orientationCorrection )
 {
-  return GetImplementation(*this).Load( Toolkit::Internal::VisualUrl(url), dimensions, fittingMode, samplingMode, orientationCorrection );
+  return GetImplementation(*this).Load( Toolkit::Internal::VisualUrl(url), dimensions, fittingMode, samplingMode, orientationCorrection, DevelAsyncImageLoader::PreMultiplyOnLoad::OFF );
 }
 
 bool AsyncImageLoader::Cancel( uint32_t loadingTaskId )
index 3289751..82ba193 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    1.4.23
+Version:    1.4.24
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT