Merge "Support glTF extention: KHR_mesh_quantization" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 3 Nov 2023 17:19:11 +0000 (17:19 +0000)
committerGerrit Code Review <gerrit@review>
Fri, 3 Nov 2023 17:19:11 +0000 (17:19 +0000)
23 files changed:
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
automated-tests/src/dali-toolkit/utc-Dali-Image.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/image-loader/fast-track-loading-task.cpp
dali-toolkit/internal/image-loader/loading-task.cpp
dali-toolkit/internal/texture-manager/texture-manager-impl.cpp
dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.cpp
dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h
dali-toolkit/internal/visuals/svg/svg-task.cpp
dali-toolkit/internal/visuals/svg/svg-task.h
dali-toolkit/internal/visuals/svg/svg-visual.cpp
dali-toolkit/internal/visuals/text/text-visual.cpp
dali-toolkit/internal/visuals/text/text-visual.h
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/public-api/image-loader/image.cpp
dali-toolkit/public-api/image-loader/image.h
packaging/dali-toolkit.spec

index a510323..bb45bda 100644 (file)
@@ -90,6 +90,16 @@ public:
     return true;
   }
 
+  bool Load(const Dali::Vector<uint8_t>& data)
+  {
+    Dali::Mutex::ScopedLock lock(mMutex);
+
+    mDefaultWidth  = 100;
+    mDefaultHeight = 100;
+
+    return true;
+  }
+
   void SetRenderer(Dali::Renderer renderer)
   {
     mRenderer = renderer;
@@ -316,6 +326,11 @@ bool VectorAnimationRenderer::Load(const std::string& url)
   return Internal::Adaptor::GetImplementation(*this).Load(url);
 }
 
+bool VectorAnimationRenderer::Load(const Dali::Vector<uint8_t>& data)
+{
+  return Internal::Adaptor::GetImplementation(*this).Load(data);
+}
+
 void VectorAnimationRenderer::SetRenderer(Renderer renderer)
 {
   Internal::Adaptor::GetImplementation(*this).SetRenderer(renderer);
index e6451bc..dd21194 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <dali-toolkit/public-api/image-loader/image-url.h>
 #include <dali-toolkit/public-api/image-loader/image.h>
+#include <dali/devel-api/adaptor-framework/native-image-source-queue.h>
 #include <dali/public-api/adaptor-framework/native-image-source.h>
 #include <dali/public-api/images/pixel-data.h>
 #include <dali/public-api/rendering/frame-buffer.h>
@@ -182,6 +183,60 @@ int UtcDaliImageConvertNativeImageSourceToUrl02(void)
   END_TEST;
 }
 
+int UtcDaliImageConvertNativeImageInterfaceToUrl01(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliImageConvertNativeImageInterfaceToUrl01");
+
+  unsigned int width(64);
+  unsigned int height(64);
+  try
+  {
+    NativeImageSourceQueuePtr nativeImageQueue = NativeImageSourceQueue::New(width, height, (Dali::NativeImageSourceQueue::ColorFormat::BGR888));
+
+    DALI_TEST_CHECK(Dali::Toolkit::Image::GenerateUrl(nativeImageQueue).GetUrl().size() > 0u);
+  }
+  catch(Dali::DaliException& e)
+  {
+    DALI_TEST_PRINT_ASSERT(e);
+    DALI_TEST_ASSERT(e, "Adaptor::IsAvailable()", TEST_LOCATION);
+  }
+  catch(...)
+  {
+    tet_printf("Assertion test failed - wrong Exception\n");
+    tet_result(TET_FAIL);
+  }
+
+  END_TEST;
+}
+
+int UtcDaliImageConvertNativeImageInterfaceToUrl02(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliImageConvertNativeImageInterfaceToUrl02");
+
+  unsigned int width(64);
+  unsigned int height(64);
+  try
+  {
+    NativeImageSourceQueuePtr nativeImageQueue = NativeImageSourceQueue::New(width, height, (Dali::NativeImageSourceQueue::ColorFormat::BGR888));
+
+    DALI_TEST_CHECK(Dali::Toolkit::Image::GenerateUrl(nativeImageQueue, true).GetUrl().size() > 0u);
+  }
+  catch(Dali::DaliException& e)
+  {
+    DALI_TEST_PRINT_ASSERT(e);
+    DALI_TEST_ASSERT(e, "Adaptor::IsAvailable()", TEST_LOCATION);
+  }
+  catch(...)
+  {
+    tet_printf("Assertion test failed - wrong Exception\n");
+    tet_result(TET_FAIL);
+  }
+
+  END_TEST;
+}
+
 int UtcDaliImageConvertEncodedImageBufferToUrl(void)
 {
   ToolkitTestApplication application;
index e1c93f6..7b07ffc 100644 (file)
@@ -680,6 +680,72 @@ int UtcDaliImageVisualWithPixelDataMasking(void)
   END_TEST;
 }
 
+int UtcDaliImageVisualWithPixelDataMasking02(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("Load premultiplied external texture with mask");
+
+  TestGlAbstraction& gl           = application.GetGlAbstraction();
+  TraceCallStack&    textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
+  uint32_t width(64);
+  uint32_t height(64);
+  uint32_t bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::RGBA8888);
+
+  uint8_t*  buffer    = reinterpret_cast<uint8_t*>(malloc(bufferSize));
+  PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+
+  DALI_TEST_CHECK(pixelData);
+
+  ImageUrl    imageUrl = Dali::Toolkit::Image::GenerateUrl(pixelData, true);
+  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);
+  propertyMap.Insert(ImageVisual::Property::ALPHA_MASK_URL, TEST_MASK_IMAGE_FILE_NAME);
+
+  Visual::Base visual = factory.CreateVisual(propertyMap);
+  DALI_TEST_CHECK(visual);
+
+  Property::Map testMap;
+  visual.CreatePropertyMap(testMap);
+  DALI_TEST_EQUALS(*testMap.Find(ImageVisual::Property::ALPHA_MASK_URL), Property::Value(TEST_MASK_IMAGE_FILE_NAME), TEST_LOCATION);
+
+  DummyControl      actor     = DummyControl::New();
+  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+  dummyImpl.RegisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1, visual);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+
+  application.GetScene().Add(actor);
+  application.SendNotification();
+  application.Render(16);
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+  DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+  DALI_TEST_EQUALS(actor.IsResourceReady(), true, TEST_LOCATION);
+
+  Renderer renderer = actor.GetRendererAt(0);
+
+  //Check visual property
+  DALI_TEST_EQUALS(*testMap.Find(Visual::Property::PREMULTIPLIED_ALPHA), Property::Value(true), TEST_LOCATION);
+
+  // Check whether preMultipliedAlpha is true.
+  auto preMultipliedAlpha = renderer.GetProperty<bool>(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+  DALI_TEST_EQUALS(preMultipliedAlpha, true, TEST_LOCATION);
+
+  dummyImpl.UnregisterVisual(Control::CONTROL_PROPERTY_END_INDEX + 1);
+  DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
+
+  END_TEST;
+}
+
 int UtcDaliImageVisualWithPixelDataMaskingSynchronously(void)
 {
   ToolkitTestApplication application;
index 93c436e..d95da08 100644 (file)
@@ -803,10 +803,7 @@ bool TextField::OnAccessibilityActivated()
 void TextField::OnTap(const TapGesture& gesture)
 {
   DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField::OnTap %p\n", mController.Get());
-  if(mInputMethodContext && IsEditable())
-  {
-    mInputMethodContext.Activate();
-  }
+
   // Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
   Extents padding;
   padding                   = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
index 25d40de..9b4c92e 100644 (file)
@@ -220,9 +220,10 @@ void FastTrackLoadingTask::Load()
   {
     std::ostringstream oss;
     oss << "[";
-    oss << "pixelBuffers: " << pixelBuffers.size() << " ";
+    oss << "pixelBuffers:" << pixelBuffers.size() << " ";
     if(!pixelBuffers.empty())
     {
+      oss << "size:" << pixelBuffers[0].GetWidth() << "x" << pixelBuffers[0].GetHeight() << " ";
       oss << "premult:" << mPremultiplied << " ";
     }
     oss << "url:" << mUrl.GetUrl() << "]";
index a1fcd63..bab5888 100644 (file)
@@ -185,10 +185,11 @@ void LoadingTask::Process()
     std::ostringstream oss;
     oss << "[";
     oss << "masking:" << isMaskTask << " ";
-    oss << "index: " << frameIndex << " ";
-    oss << "pixelBuffers: " << pixelBuffers.size() << " ";
+    oss << "index:" << frameIndex << " ";
+    oss << "pixelBuffers:" << pixelBuffers.size() << " ";
     if(!pixelBuffers.empty())
     {
+      oss << "size:" << pixelBuffers[0].GetWidth() << "x" << pixelBuffers[0].GetHeight() << " ";
       oss << "premult:" << pixelBuffers[0].IsAlphaPreMultiplied() << " ";
     }
     oss << "url:" << (!!(animatedImageLoading) ? animatedImageLoading.GetUrl() : url.GetUrl()) << "]";
index 3b212c3..0dceae2 100644 (file)
@@ -584,6 +584,7 @@ TextureManager::TextureId TextureManager::RequestLoadInternal(
   {
     if(textureInfo.loadState != LoadState::UPLOADED)
     {
+      textureInfo.preMultiplied = (preMultiplyOnLoad == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD);
       textureInfo.loadState = TextureManager::LoadState::WAITING_FOR_MASK;
     }
   }
index d85d6ed..61f1b4d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -35,7 +35,7 @@ namespace Internal
 {
 namespace
 {
-const int CUSTOM_PROPERTY_COUNT(12); // 5 transform properties + Start point/color, end point/color, rotate center/angle, offset
+const int CUSTOM_PROPERTY_COUNT(7); // Start point/color, end point/color, rotate center/angle, offset
 
 DALI_ENUM_TO_STRING_TABLE_BEGIN(GRADIENT_TYPE)
   DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::DevelAnimatedGradientVisual::GradientType, LINEAR)
index dfa9f2e..adf8da8 100644 (file)
@@ -47,7 +47,7 @@ FixedImageCache::FixedImageCache(TextureManager&                     textureMana
                                  bool                                preMultiplyOnLoad)
 : ImageCache(textureManager, size, fittingMode, samplingMode, maskingData, observer, batchSize, interval, preMultiplyOnLoad),
   mImageUrls(urlList),
-  mFront(FIRST_FRAME_INDEX)
+  mCurrentFrameIndex(FIRST_FRAME_INDEX)
 {
   mReadyFlags.reserve(mImageUrls.size());
 }
@@ -67,17 +67,17 @@ TextureSet FixedImageCache::Frame(uint32_t frameIndex)
   }
 
   while(mReadyFlags.size() < mImageUrls.size() &&
-        (frameIndex > mFront || mReadyFlags.empty()))
+        (frameIndex > mCurrentFrameIndex || mReadyFlags.empty()))
   {
-    ++mFront;
+    ++mCurrentFrameIndex;
     LoadBatch();
   }
 
-  mFront = frameIndex;
+  mCurrentFrameIndex = frameIndex;
 
-  if(IsFrontReady() && mLoadState != TextureManager::LoadState::LOAD_FAILED)
+  if(IsFrameReady(mCurrentFrameIndex) && mLoadState != TextureManager::LoadState::LOAD_FAILED)
   {
-    textureSet = GetFrontTextureSet();
+    textureSet = GetTextureSet(mCurrentFrameIndex);
   }
 
   return textureSet;
@@ -97,7 +97,7 @@ uint32_t FixedImageCache::GetFrameInterval(uint32_t frameIndex) const
 
 int32_t FixedImageCache::GetCurrentFrameIndex() const
 {
-  return static_cast<int32_t>(mFront);
+  return static_cast<int32_t>(mCurrentFrameIndex);
 }
 
 int32_t FixedImageCache::GetTotalFrameCount() const
@@ -105,9 +105,9 @@ int32_t FixedImageCache::GetTotalFrameCount() const
   return mImageUrls.size();
 }
 
-bool FixedImageCache::IsFrontReady() const
+bool FixedImageCache::IsFrameReady(uint32_t frameIndex) const
 {
-  return (mReadyFlags.size() > 0 && mReadyFlags[mFront] == true);
+  return (mReadyFlags.size() > 0 && mReadyFlags[frameIndex] == true);
 }
 
 void FixedImageCache::LoadBatch()
@@ -143,9 +143,9 @@ void FixedImageCache::LoadBatch()
   }
 }
 
-TextureSet FixedImageCache::GetFrontTextureSet() const
+TextureSet FixedImageCache::GetTextureSet(uint32_t frameIndex) const
 {
-  TextureSet textureSet = mTextureManager.GetTextureSet(mImageUrls[mFront].mTextureId);
+  TextureSet textureSet = mTextureManager.GetTextureSet(mImageUrls[frameIndex].mTextureId);
   if(textureSet)
   {
     Sampler sampler = Sampler::New();
@@ -155,11 +155,11 @@ TextureSet FixedImageCache::GetFrontTextureSet() const
   return textureSet;
 }
 
-void FixedImageCache::CheckFrontFrame(bool wasReady, bool preMultiplied)
+void FixedImageCache::MakeReady(bool wasReady, uint32_t frameIndex, bool preMultiplied)
 {
-  if(wasReady == false && IsFrontReady())
+  if(wasReady == false && IsFrameReady(frameIndex))
   {
-    mObserver.FrameReady(GetFrontTextureSet(), mInterval, preMultiplied);
+    mObserver.FrameReady(GetTextureSet(frameIndex), mInterval, preMultiplied);
   }
 }
 
@@ -186,7 +186,7 @@ void FixedImageCache::LoadComplete(bool loadSuccess, TextureInformation textureI
   if(loadSuccess)
   {
     mLoadState           = TextureManager::LoadState::LOAD_FINISHED;
-    bool frontFrameReady = IsFrontReady();
+    bool isCurrentFrameReady = IsFrameReady(mCurrentFrameIndex);
     if(!mRequestingLoad)
     {
       for(std::size_t i = 0; i < mImageUrls.size(); ++i)
@@ -202,7 +202,7 @@ void FixedImageCache::LoadComplete(bool loadSuccess, TextureInformation textureI
     {
       mReadyFlags.back() = true;
     }
-    CheckFrontFrame(frontFrameReady, textureInformation.preMultiplied);
+    MakeReady(isCurrentFrameReady, mCurrentFrameIndex, textureInformation.preMultiplied);
   }
   else
   {
index 62cd174..4fc4ecc 100644 (file)
@@ -91,11 +91,12 @@ public:
 
 private:
   /**
-   * @brief Check whether the front frame is ready or not.
+   * @brief Check whether the frame is ready or not.
+   * @param[in] frameIndex The frame index to check the frame is ready or not.
    *
-   * @return true if the front frame is ready
+   * @return true if the frame is ready
    */
-  bool IsFrontReady() const;
+  bool IsFrameReady(uint32_t frameIndex) const;
 
   /**
    * @brief Load the next batch of images
@@ -103,19 +104,21 @@ private:
   void LoadBatch();
 
   /**
-   * @brief Get the texture set of the front frame.
+   * @brief Get the texture set at the input frame index
+   * @param[in] frameIndex The frame index to retrieve texture set.
    *
    * @return the texture set of the front of Cache.
    */
-  TextureSet GetFrontTextureSet() const;
+  TextureSet GetTextureSet(uint32_t frameIndex) const;
 
   /**
    * @brief Check if the front frame has become ready - if so, inform observer
    *
    * @param[in] wasReady Readiness before call.
+   * @param[in] frameIndex The frame index for this frame
    * @param[in] preMultiplied whether the texture is premultied alpha or not.
    */
-  void CheckFrontFrame(bool wasReady, bool preMultiplied);
+  void MakeReady(bool wasReady, uint32_t frameIndex, bool preMultiplied);
 
 protected:
   /**
@@ -127,7 +130,7 @@ private:
   std::vector<UrlStore>&                 mImageUrls;
   std::vector<bool>                      mReadyFlags;
   std::vector<TextureManager::LoadState> mLoadStates;
-  uint32_t                               mFront;
+  uint32_t                               mCurrentFrameIndex;
 };
 
 } //namespace Internal
index 53ba256..982d6dd 100644 (file)
@@ -87,7 +87,7 @@ AnimatedVectorImageVisualPtr AnimatedVectorImageVisual::New(VisualFactoryCache&
 
 AnimatedVectorImageVisual::AnimatedVectorImageVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, ImageDimensions size)
 : Visual::Base(factoryCache, Visual::FittingMode::FILL, static_cast<Toolkit::Visual::Type>(Toolkit::DevelVisual::ANIMATED_VECTOR_IMAGE)),
-  mUrl(imageUrl),
+  mImageUrl(imageUrl),
   mAnimationData(),
   mVectorAnimationTask(new VectorAnimationTask(factoryCache)),
   mImageVisualShaderFactory(shaderFactory),
@@ -178,9 +178,9 @@ void AnimatedVectorImageVisual::DoCreatePropertyMap(Property::Map& map) const
 {
   map.Clear();
   map.Insert(Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::ANIMATED_VECTOR_IMAGE);
-  if(mUrl.IsValid())
+  if(mImageUrl.IsValid())
   {
-    map.Insert(Toolkit::ImageVisual::Property::URL, mUrl.GetUrl());
+    map.Insert(Toolkit::ImageVisual::Property::URL, mImageUrl.GetUrl());
   }
   map.Insert(Toolkit::DevelImageVisual::Property::LOOP_COUNT, mAnimationData.loopCount);
 
@@ -380,7 +380,7 @@ void AnimatedVectorImageVisual::OnInitialize(void)
   mVectorAnimationTask->ResourceReadySignal().Connect(this, &AnimatedVectorImageVisual::OnResourceReady);
   mVectorAnimationTask->SetAnimationFinishedCallback(MakeCallback(this, &AnimatedVectorImageVisual::OnAnimationFinished));
 
-  mVectorAnimationTask->RequestLoad(mUrl.GetUrl(), IsSynchronousLoadingRequired());
+  mVectorAnimationTask->RequestLoad(mImageUrl, IsSynchronousLoadingRequired());
 
   auto& vectorAnimationManager = mFactoryCache.GetVectorAnimationManager();
   vectorAnimationManager.AddObserver(*this);
index b0a7569..e013d6c 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_ANIMATED_VECTOR_IMAGE_VISUAL_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -237,7 +237,7 @@ private:
   AnimatedVectorImageVisual& operator=(const AnimatedVectorImageVisual& visual) = delete;
 
 private:
-  VisualUrl                          mUrl;
+  VisualUrl                          mImageUrl;
   VectorAnimationTask::AnimationData mAnimationData;
   VectorAnimationTaskPtr             mVectorAnimationTask;
   ImageVisualShaderFactory&          mImageVisualShaderFactory;
index 6bb0d13..df38f9c 100644 (file)
@@ -54,7 +54,7 @@ DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_IMAGE_PERFORMANCE_MARKER, false)
 
 VectorAnimationTask::VectorAnimationTask(VisualFactoryCache& factoryCache)
 : AsyncTask(MakeCallback(this, &VectorAnimationTask::TaskCompleted), AsyncTask::PriorityType::HIGH, AsyncTask::ThreadType::WORKER_THREAD),
-  mUrl(),
+  mImageUrl(),
   mVectorRenderer(VectorAnimationRenderer::New()),
   mAnimationData(),
   mVectorAnimationThread(factoryCache.GetVectorAnimationManager().GetVectorAnimationThread()),
@@ -143,17 +143,36 @@ bool VectorAnimationTask::IsAnimating()
 
 bool VectorAnimationTask::Load(bool synchronousLoading)
 {
-  DALI_TRACE_SCOPE(gTraceFilter, "DALI_LOTTIE_LOADING_TASK");
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[url:" << mImageUrl.GetUrl() << "]";
+    DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_LOADING_TASK", oss.str().c_str());
+  }
+#endif
+
+  if(!mVectorRenderer.Load(mImageUrl.GetUrl()))
+  {
+    DALI_LOG_ERROR("VectorAnimationTask::Load: Load failed [%s]\n", mImageUrl.GetUrl().c_str());
+    mLoadFailed = true;
+  }
 
-  if(!mVectorRenderer.Load(mUrl))
+  if(mLoadFailed)
   {
-    DALI_LOG_ERROR("VectorAnimationTask::Load: Load failed [%s]\n", mUrl.c_str());
     mLoadRequest = false;
-    mLoadFailed  = true;
     if(!synchronousLoading && mLoadCompletedCallback)
     {
       mVectorAnimationThread.AddEventTriggerCallback(mLoadCompletedCallback.get());
     }
+#ifdef TRACE_ENABLED
+    if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+    {
+      std::ostringstream oss;
+      oss << "[url:" << mImageUrl.GetUrl() << "]";
+      DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_LOADING_TASK", oss.str().c_str());
+    }
+#endif
     return false;
   }
 
@@ -170,7 +189,16 @@ bool VectorAnimationTask::Load(bool synchronousLoading)
     mVectorAnimationThread.AddEventTriggerCallback(mLoadCompletedCallback.get());
   }
 
-  DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::Load: file = %s [%d frames, %f fps] [%p]\n", mUrl.c_str(), mTotalFrame, mFrameRate, this);
+  DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::Load: file = %s [%d frames, %f fps] [%p]\n", mImageUrl.GetUrl().c_str(), mTotalFrame, mFrameRate, this);
+
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[url:" << mImageUrl.GetUrl() << "]";
+    DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_LOADING_TASK", oss.str().c_str());
+  }
+#endif
 
   return true;
 }
@@ -184,9 +212,9 @@ void VectorAnimationTask::SetRenderer(Renderer renderer)
   DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetRenderer [%p]\n", this);
 }
 
-void VectorAnimationTask::RequestLoad(const std::string& url, bool synchronousLoading)
+void VectorAnimationTask::RequestLoad(const VisualUrl& url, bool synchronousLoading)
 {
-  mUrl = url;
+  mImageUrl = url;
 
   if(!synchronousLoading)
   {
@@ -366,7 +394,7 @@ void VectorAnimationTask::SetPlayRange(const Property::Array& playRange)
       mCurrentFrame = mEndFrame;
     }
 
-    DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetPlayRange: [%d, %d] [%s] [%p]\n", mStartFrame, mEndFrame, mUrl.c_str(), this);
+    DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetPlayRange: [%d, %d] [%s] [%p]\n", mStartFrame, mEndFrame, mImageUrl.GetUrl().c_str(), this);
   }
 }
 
@@ -461,7 +489,15 @@ bool VectorAnimationTask::Rasterize()
     return false;
   }
 
-  DALI_TRACE_BEGIN(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK");
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[size:" << mWidth << "x" << mHeight << " ";
+    oss << "url:" << mImageUrl.GetUrl() << "]";
+    DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK", oss.str().c_str());
+  }
+#endif
 
   ApplyAnimationData();
 
@@ -574,10 +610,11 @@ bool VectorAnimationTask::Rasterize()
   if(gTraceFilter && gTraceFilter->IsTraceEnabled())
   {
     std::ostringstream oss;
-    oss << "[size: " << mWidth << " x " << mHeight << ", ";
-    oss << "frame: " << mCurrentFrame << ", ";
-    oss << "loop: " << mCurrentLoop << ", ";
-    oss << "state : " << mPlayState << "]";
+    oss << "[size:" << mWidth << "x" << mHeight << " ";
+    oss << "frame:" << mCurrentFrame << " ";
+    oss << "loop:" << mCurrentLoop << " ";
+    oss << "state:" << mPlayState << " ";
+    oss << "url:" << mImageUrl.GetUrl() << "]";
     DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_LOTTIE_RASTERIZE_TASK", oss.str().c_str());
   }
 #endif
index fdf1e2c..c3ac749 100644 (file)
@@ -30,6 +30,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-actions-devel.h>
 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
+#include <dali-toolkit/internal/visuals/visual-url.h>
 
 namespace Dali
 {
@@ -163,7 +164,7 @@ public:
    * @param[in] url The url of the vector animation file
    * @param[in] synchronousLoading True if the url should be loaded synchronously
    */
-  void RequestLoad(const std::string& url, bool synchronousLoading);
+  void RequestLoad(const VisualUrl& url, bool synchronousLoading);
 
   /**
    * @brief Queries whether loading is requested.
@@ -355,7 +356,7 @@ private:
     PAUSED    ///< The animation is paused
   };
 
-  std::string                          mUrl;
+  VisualUrl                            mImageUrl;
   VectorAnimationRenderer              mVectorRenderer;
   std::vector<AnimationData>           mAnimationData[2];
   VectorAnimationThread&               mVectorAnimationThread;
index bcd0f91..5bf92a4 100644 (file)
@@ -66,7 +66,7 @@ VectorImageRenderer SvgTask::GetRenderer()
 
 SvgLoadingTask::SvgLoadingTask(VectorImageRenderer vectorRenderer, const VisualUrl& url, float dpi, CallbackBase* callback)
 : SvgTask(vectorRenderer, callback, url.GetProtocolType() == VisualUrl::ProtocolType::REMOTE ? AsyncTask::PriorityType::LOW : AsyncTask::PriorityType::HIGH),
-  mUrl(url),
+  mImageUrl(url),
   mDpi(dpi)
 {
 }
@@ -84,36 +84,57 @@ void SvgLoadingTask::Process()
     return;
   }
 
-  DALI_TRACE_SCOPE(gTraceFilter, "DALI_SVG_LOADING_TASK");
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[url:" << mImageUrl.GetUrl() << "]";
+    DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_SVG_LOADING_TASK", oss.str().c_str());
+  }
+#endif
+
+  bool loadFailed = false;
 
   Dali::Vector<uint8_t> buffer;
 
-  if(!mUrl.IsLocalResource())
+  if(!mImageUrl.IsLocalResource())
   {
-    if(!Dali::FileLoader::DownloadFileSynchronously(mUrl.GetUrl(), buffer))
+    if(!Dali::FileLoader::DownloadFileSynchronously(mImageUrl.GetUrl(), buffer))
     {
-      DALI_LOG_ERROR("Failed to download file! [%s]\n", mUrl.GetUrl().c_str());
-      return;
+      DALI_LOG_ERROR("Failed to download file! [%s]\n", mImageUrl.GetUrl().c_str());
+      loadFailed = true;
     }
   }
   else
   {
-    if(!Dali::FileLoader::ReadFile(mUrl.GetUrl(), buffer))
+    if(!Dali::FileLoader::ReadFile(mImageUrl.GetUrl(), buffer))
     {
-      DALI_LOG_ERROR("Failed to read file! [%s]\n", mUrl.GetUrl().c_str());
-      return;
+      DALI_LOG_ERROR("Failed to read file! [%s]\n", mImageUrl.GetUrl().c_str());
+      loadFailed = true;
     }
   }
 
-  buffer.PushBack('\0');
-
-  if(!mVectorRenderer.Load(buffer, mDpi))
+  if(!loadFailed)
   {
-    DALI_LOG_ERROR("Failed to load data! [%s]\n", mUrl.GetUrl().c_str());
-    return;
+    buffer.PushBack('\0');
+
+    if(!mVectorRenderer.Load(buffer, mDpi))
+    {
+      DALI_LOG_ERROR("Failed to load data! [%s]\n", mImageUrl.GetUrl().c_str());
+      loadFailed = true;
+    }
   }
 
-  mHasSucceeded = true;
+  mHasSucceeded = !loadFailed;
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[success:" << mHasSucceeded << " ";
+    oss << "url:" << mImageUrl.GetUrl() << "]";
+    DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_SVG_LOADING_TASK", oss.str().c_str());
+  }
+#endif
 }
 
 bool SvgLoadingTask::IsReady()
@@ -144,7 +165,8 @@ void SvgRasterizingTask::Process()
   if(gTraceFilter && gTraceFilter->IsTraceEnabled())
   {
     std::ostringstream oss;
-    oss << "[size: " << mWidth << " x " << mHeight << "]";
+    oss << "[size:" << mWidth << "x" << mHeight << " ";
+    oss << "url:" << mImageUrl.GetUrl() << "]";
     DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", oss.str().c_str());
   }
 #endif
@@ -153,13 +175,30 @@ void SvgRasterizingTask::Process()
   if(!pixelBuffer)
   {
     DALI_LOG_ERROR("Rasterize is failed!\n");
-    DALI_TRACE_END(gTraceFilter, "DALI_SVG_RASTERIZE_TASK");
+#ifdef TRACE_ENABLED
+    if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+    {
+      std::ostringstream oss;
+      oss << "[size:" << mWidth << "x" << mHeight << " ";
+      oss << "url:" << mImageUrl.GetUrl() << "]";
+      DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", oss.str().c_str());
+    }
+#endif
     return;
   }
 
   mPixelData    = Devel::PixelBuffer::Convert(pixelBuffer);
   mHasSucceeded = true;
-  DALI_TRACE_END(gTraceFilter, "DALI_SVG_RASTERIZE_TASK");
+
+#ifdef TRACE_ENABLED
+  if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+  {
+    std::ostringstream oss;
+    oss << "[size:" << mWidth << "x" << mHeight << " ";
+    oss << "url:" << mImageUrl.GetUrl() << "]";
+    DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_SVG_RASTERIZE_TASK", oss.str().c_str());
+  }
+#endif
 }
 
 bool SvgRasterizingTask::IsReady()
index 89d8f55..beeaee4 100644 (file)
@@ -141,7 +141,7 @@ private:
   SvgLoadingTask& operator=(const SvgLoadingTask& task) = delete;
 
 private:
-  VisualUrl mUrl;
+  VisualUrl mImageUrl;
   float     mDpi;
 };
 
@@ -179,6 +179,17 @@ public:
    */
   PixelData GetPixelData() const override;
 
+#ifdef TRACE_ENABLED
+  /**
+   * Set the url of rasterizatoin visual. Only for tracing
+   * @param[in] url The url of this visual
+   */
+  void SetUrl(VisualUrl url)
+  {
+    mImageUrl = std::move(url);
+  }
+#endif
+
 private:
   // Undefined
   SvgRasterizingTask(const SvgRasterizingTask& task) = delete;
@@ -187,6 +198,9 @@ private:
   SvgRasterizingTask& operator=(const SvgRasterizingTask& task) = delete;
 
 private:
+#ifdef TRACE_ENABLED
+  VisualUrl mImageUrl{};
+#endif
   PixelData mPixelData;
   uint32_t  mWidth;
   uint32_t  mHeight;
index 3f280d1..33b7781 100644 (file)
@@ -322,6 +322,10 @@ void SvgVisual::AddRasterizationTask(const Vector2& size)
 
     mRasterizingTask = new SvgRasterizingTask(mVectorRenderer, width, height, MakeCallback(this, &SvgVisual::ApplyRasterizedImage));
 
+#ifdef TRACE_ENABLED
+    reinterpret_cast<SvgRasterizingTask*>(mRasterizingTask.Get())->SetUrl(mImageUrl);
+#endif
+
     if(IsSynchronousLoadingRequired() && mImageUrl.IsLocalResource())
     {
       mRasterizingTask->Process();
index b7bdbfb..b3801f6 100644 (file)
@@ -53,7 +53,7 @@ namespace
 {
 DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_TEXT_PERFORMANCE_MARKER, false);
 
-const int CUSTOM_PROPERTY_COUNT(5); // anim,premul,size,offset,multicol
+const int CUSTOM_PROPERTY_COUNT(2); // uTextColorAnimatable, uHasMultipleTextColors
 
 /**
  * Return Property index for the given string key
@@ -256,6 +256,7 @@ TextVisual::TextVisual(VisualFactoryCache& factoryCache, TextVisualShaderFactory
   mTypesetter(Text::Typesetter::New(mController->GetTextModel())),
   mTextVisualShaderFactory(shaderFactory),
   mTextShaderFeatureCache(),
+  mHasMultipleTextColorsIndex(Property::INVALID_INDEX),
   mAnimatableTextColorPropertyIndex(Property::INVALID_INDEX),
   mTextColorAnimatableIndex(Property::INVALID_INDEX),
   mRendererUpdateNeeded(false)
@@ -275,6 +276,7 @@ void TextVisual::OnInitialize()
 
   mImpl->mRenderer = VisualRenderer::New(geometry, shader);
   mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
+  mHasMultipleTextColorsIndex = mImpl->mRenderer.RegisterUniqueProperty("uHasMultipleTextColors", false);
 }
 
 void TextVisual::DoSetProperties(const Property::Map& propertyMap)
@@ -643,7 +645,7 @@ void TextVisual::CreateTextureSet(TilingInfo& info, VisualRenderer& renderer, Sa
 
   // Enable the pre-multiplied alpha to improve the text quality
   renderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true);
-  renderer.RegisterProperty(PREMULTIPLIED_ALPHA, 1.0f);
+  renderer.SetProperty(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, true);
 
   // Set size and offset for the tiling.
   renderer.SetProperty(VisualRenderer::Property::TRANSFORM_SIZE, Vector2(info.width, info.height));
@@ -672,7 +674,7 @@ void TextVisual::AddRenderer(Actor& actor, const Vector2& size, bool hasMultiple
     mImpl->mRenderer.SetTextures(textureSet);
     //Register transform properties
     mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
-    mImpl->mRenderer.RegisterProperty("uHasMultipleTextColors", static_cast<float>(hasMultipleTextColors));
+    mImpl->mRenderer.SetProperty(mHasMultipleTextColorsIndex, static_cast<float>(hasMultipleTextColors));
     mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
 
     mRendererList.push_back(mImpl->mRenderer);
index 1b1930d..7be059c 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -315,6 +315,7 @@ private:
   WeakHandle<Actor> mControl;                          ///< The control where the renderer is added.
   Constraint        mColorConstraint{};                ///< Color constraint
   Constraint        mOpacityConstraint{};              ///< Opacity constraint
+  Property::Index   mHasMultipleTextColorsIndex;       ///< The index of uHasMultipleTextColors proeprty.
   Property::Index   mAnimatableTextColorPropertyIndex; ///< The index of animatable text color property registered by the control.
   Property::Index   mTextColorAnimatableIndex;         ///< The index of uTextColorAnimatable property.
   bool              mRendererUpdateNeeded : 1;         ///< The flag to indicate whether the renderer needs to be updated.
index 3ec705e..30096cb 100644 (file)
@@ -29,7 +29,7 @@ namespace Toolkit
 {
 const unsigned int TOOLKIT_MAJOR_VERSION = 2;
 const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 49;
+const unsigned int TOOLKIT_MICRO_VERSION = 51;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index dea398a..5481d5f 100644 (file)
@@ -55,9 +55,9 @@ Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData, bool preMul
   return imageUrl;
 }
 
-Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource, bool preMultiplied)
+Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageInterfacePtr nativeImageInterface, bool preMultiplied)
 {
-  Texture texture = Dali::Texture::New(*nativeImageSource);
+  Texture texture = Dali::Texture::New(*nativeImageInterface);
   Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture, preMultiplied);
   return imageUrl;
 }
index bdb9996..96b40f9 100644 (file)
@@ -18,8 +18,8 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/adaptor-framework/native-image-source.h>
 #include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
+#include <dali/public-api/images/native-image-interface.h>
 #include <dali/public-api/images/pixel-data.h>
 #include <dali/public-api/rendering/frame-buffer.h>
 
@@ -33,7 +33,7 @@ namespace Toolkit
 {
 /**
  * API to interface with the toolkit image
- * Allows developers to add FrameBuffer, PixelData and NativeImageSource to toolkit so that visuals can use them to render
+ * Allows developers to add FrameBuffer, PixelData and NativeImageInterface to toolkit so that visuals can use them to render
  */
 namespace Image
 {
@@ -72,14 +72,14 @@ DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer fra
 DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData, bool preMultiplied = false);
 
 /**
- * @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
- * @param[in] preMultiplied Whether this native image source preMultiplied or not. Default as false.
- * @return the ImageUrl representing this native image source
+ * @brief Generate a Url from native image interface.
+ * This Url can be used in visuals to render the native image interface.
+ * @note This method does not check for duplicates, If same native image interface is entered multiple times, a different URL is returned each time.
+ * @param[in] nativeImageInterface the native image interface to converted to Url
+ * @param[in] preMultiplied Whether this native image interface preMultiplied or not. Default as false.
+ * @return the ImageUrl representing this native image interface
  */
-DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource, bool preMultiplied = false);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageInterfacePtr nativeImageInterface, bool preMultiplied = false);
 
 /**
  * @brief Generate a Url from encoded image buffer.
index 9c8309c..ea0f852 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.2.49
+Version:    2.2.51
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT