Revert "[Tizen] (Vector) Change event processing"
authorJoogab Yun <joogab.yun@samsung.com>
Mon, 24 Aug 2020 05:28:41 +0000 (14:28 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Mon, 24 Aug 2020 05:28:41 +0000 (14:28 +0900)
This reverts commit 0c28349016869444dea4e173bfd43130a012635f.

12 files changed:
dali-toolkit/internal/controls/web-view/web-view-impl.cpp
dali-toolkit/internal/file.list
dali-toolkit/internal/visuals/animated-image/animated-image-visual.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-manager.cpp [deleted file]
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.h [deleted file]
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp
dali-toolkit/internal/visuals/svg/svg-visual.cpp
dali-toolkit/internal/visuals/visual-base-impl.cpp
dali-toolkit/internal/visuals/visual-factory-cache.cpp
dali-toolkit/internal/visuals/visual-factory-cache.h

index 80314dc..f252318 100644 (file)
@@ -31,7 +31,6 @@
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/image-loader/texture-manager.h>
 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
-#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
 
 namespace Dali
 {
index 037e641..b9fde11 100644 (file)
@@ -19,7 +19,6 @@ SET( toolkit_src_files
    ${toolkit_src_dir}/visuals/animated-image/rolling-image-cache.cpp
    ${toolkit_src_dir}/visuals/animated-image/rolling-animated-image-cache.cpp
    ${toolkit_src_dir}/visuals/animated-vector-image/animated-vector-image-visual.cpp
-   ${toolkit_src_dir}/visuals/animated-vector-image/vector-animation-manager.cpp
    ${toolkit_src_dir}/visuals/animated-vector-image/vector-animation-task.cpp
    ${toolkit_src_dir}/visuals/animated-vector-image/vector-animation-thread.cpp
    ${toolkit_src_dir}/visuals/animated-vector-image/vector-rasterize-thread.cpp
index 70419d0..e937c27 100755 (executable)
@@ -31,7 +31,6 @@
 #include <dali-toolkit/internal/visuals/visual-url.h>
 #include <dali-toolkit/internal/visuals/animated-image/image-cache.h>
 #include <dali-toolkit/devel-api/visuals/animated-image-visual-actions-devel.h>
-#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
 
 namespace Dali
 {
index 453f14e..7b263e1 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/devel-api/common/stage.h>
 #include <dali/devel-api/rendering/renderer-devel.h>
 #include <dali/devel-api/adaptor-framework/window-devel.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -33,7 +34,6 @@
 #include <dali-toolkit/internal/visuals/visual-factory-cache.h>
 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
 #include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
-#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.h>
 
 namespace Dali
 {
@@ -93,8 +93,8 @@ AnimatedVectorImageVisual::AnimatedVectorImageVisual( VisualFactoryCache& factor
   mVisualScale( Vector2::ONE ),
   mPlacementActor(),
   mPlayState( DevelImageVisual::PlayState::STOPPED ),
-  mEventCallback( nullptr ),
-  mRendererAdded( false )
+  mRendererAdded( false ),
+  mRasterizationTriggered( false )
 {
   // the rasterized image is with pre-multiplied alpha format
   mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
@@ -105,9 +105,9 @@ AnimatedVectorImageVisual::AnimatedVectorImageVisual( VisualFactoryCache& factor
 
 AnimatedVectorImageVisual::~AnimatedVectorImageVisual()
 {
-  if( mEventCallback )
+  if( mRasterizationTriggered && Adaptor::IsAvailable() )
   {
-    mFactoryCache.GetVectorAnimationManager().UnregisterEventCallback( mEventCallback );
+    Adaptor::Get().UnregisterProcessor( *this );
   }
 
   // Finalize animation task and disconnect the signal in the main thread
@@ -418,6 +418,15 @@ void AnimatedVectorImageVisual::OnDoAction( const Property::Index actionId, cons
   TriggerVectorRasterization();
 }
 
+void AnimatedVectorImageVisual::Process()
+{
+  SendAnimationData();
+
+  mRasterizationTriggered = false;
+
+  Adaptor::Get().UnregisterProcessor( *this );
+}
+
 void AnimatedVectorImageVisual::OnUploadCompleted()
 {
   // If weak handle is holding a placement actor, it is the time to add the renderer to actor.
@@ -500,11 +509,12 @@ void AnimatedVectorImageVisual::StopAnimation()
 
 void AnimatedVectorImageVisual::TriggerVectorRasterization()
 {
-  if( !mEventCallback )
+  if( !mRasterizationTriggered )
   {
-    mEventCallback = MakeCallback( this, &AnimatedVectorImageVisual::OnProcessEvents );
-    mFactoryCache.GetVectorAnimationManager().RegisterEventCallback( mEventCallback );
     Stage::GetCurrent().KeepRendering( 0.0f );  // Trigger event processing
+
+    Adaptor::Get().RegisterProcessor( *this );
+    mRasterizationTriggered = true;
   }
 }
 
@@ -566,13 +576,6 @@ void AnimatedVectorImageVisual::OnWindowVisibilityChanged( Window window, bool v
   }
 }
 
-void AnimatedVectorImageVisual::OnProcessEvents()
-{
-  SendAnimationData();
-
-  mEventCallback = nullptr;  // The callback will be deleted in the VectorAnimationManager
-}
-
 } // namespace Internal
 
 } // namespace Toolkit
index e7ba945..11b3b1c 100644 (file)
@@ -24,6 +24,7 @@
 #include <dali/public-api/object/property-notification.h>
 #include <dali/public-api/adaptor-framework/window.h>
 #include <dali/devel-api/actors/actor-devel.h>
+#include <dali/integration-api/processor-interface.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
@@ -55,7 +56,7 @@ using AnimatedVectorImageVisualPtr = IntrusivePtr< AnimatedVectorImageVisual >;
  * | url                      | STRING           |
  *
  */
-class AnimatedVectorImageVisual: public Visual::Base, public ConnectionTracker
+class AnimatedVectorImageVisual: public Visual::Base, public ConnectionTracker, public Integration::Processor
 {
 public:
 
@@ -138,6 +139,13 @@ protected:
    */
   void OnDoAction( const Property::Index actionId, const Property::Value& attributes ) override;
 
+protected: // Implementation of Processor
+
+  /**
+   * @copydoc Dali::Integration::Processor::Process()
+   */
+  void Process() override;
+
 private:
 
   /**
@@ -197,11 +205,6 @@ private:
    */
   void OnWindowVisibilityChanged( Window window, bool visible );
 
-  /**
-   * @brief Callback when the event is processed.
-   */
-  void OnProcessEvents();
-
   // Undefined
   AnimatedVectorImageVisual( const AnimatedVectorImageVisual& visual ) = delete;
 
@@ -219,8 +222,8 @@ private:
   Vector2                                      mVisualScale;
   WeakHandle< Actor >                          mPlacementActor;
   DevelImageVisual::PlayState::Type            mPlayState;
-  CallbackBase*                                mEventCallback;    // Not owned
   bool                                         mRendererAdded;
+  bool                                         mRasterizationTriggered;
 };
 
 } // namespace Internal
diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.cpp b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.cpp
deleted file mode 100644 (file)
index 8e47d81..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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/internal/visuals/animated-vector-image/vector-animation-manager.h>
-
-// EXTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-#include <dali/integration-api/adaptor-framework/adaptor.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace
-{
-
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_VECTOR_ANIMATION" );
-#endif
-
-} // unnamed namespace
-
-VectorAnimationManager::VectorAnimationManager()
-: mEventCallbacks(),
-  mVectorAnimationThread( nullptr ),
-  mProcessorRegistered( false )
-{
-}
-
-VectorAnimationManager::~VectorAnimationManager()
-{
-  for( auto&& iter : mEventCallbacks )
-  {
-    delete iter;
-  }
-  mEventCallbacks.clear();
-
-  if( mProcessorRegistered )
-  {
-    Adaptor::Get().UnregisterProcessor( *this );
-  }
-}
-
-VectorAnimationThread& VectorAnimationManager::GetVectorAnimationThread()
-{
-  if( !mVectorAnimationThread )
-  {
-    mVectorAnimationThread = std::unique_ptr< VectorAnimationThread >( new VectorAnimationThread() );
-    mVectorAnimationThread->Start();
-  }
-  return *mVectorAnimationThread;
-}
-
-void VectorAnimationManager::RegisterEventCallback( CallbackBase* callback )
-{
-  mEventCallbacks.push_back( callback );
-
-  if( !mProcessorRegistered )
-  {
-    Adaptor::Get().RegisterProcessor( *this );
-    mProcessorRegistered = true;
-  }
-}
-
-void VectorAnimationManager::UnregisterEventCallback( CallbackBase* callback )
-{
-  auto iter = std::find( mEventCallbacks.begin(), mEventCallbacks.end(), callback );
-  if( iter != mEventCallbacks.end() )
-  {
-    mEventCallbacks.erase( iter );
-
-    if( mEventCallbacks.empty() )
-    {
-      if( Adaptor::IsAvailable() )
-      {
-        Adaptor::Get().UnregisterProcessor( *this );
-        mProcessorRegistered = false;
-      }
-    }
-  }
-}
-
-void VectorAnimationManager::Process()
-{
-  for( auto&& iter : mEventCallbacks )
-  {
-    CallbackBase::Execute( *iter );
-    delete iter;
-  }
-  mEventCallbacks.clear();
-
-  Adaptor::Get().UnregisterProcessor( *this );
-  mProcessorRegistered = false;
-}
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.h b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.h
deleted file mode 100644 (file)
index 2b36c7d..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef DALI_TOOLKIT_INTERNAL_VECTOR_ANIMATION_MANAGER_H
-#define DALI_TOOLKIT_INTERNAL_VECTOR_ANIMATION_MANAGER_H
-
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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/signals/callback.h>
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/integration-api/processor-interface.h>
-#include <memory>
-
-// INTERNAL INCLUDES
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-class VectorAnimationThread;
-
-/**
- * @brief Vector animation manager
- */
-class VectorAnimationManager: public Integration::Processor
-{
-public:
-
-  /**
-   * @brief Constructor.
-   */
-  VectorAnimationManager();
-
-  /**
-   * @brief Destructor.
-   */
-  virtual ~VectorAnimationManager();
-
-  /**
-   * Get the vector animation thread.
-   * @return A raw pointer pointing to the vector animation thread.
-   */
-  VectorAnimationThread& GetVectorAnimationThread();
-
-  /**
-   * @brief Register a callback.
-   *
-   * @param callback The callback to register
-   * @note Ownership of the callback is passed onto this class.
-   */
-  void RegisterEventCallback( CallbackBase* callback );
-
-  /**
-   * @brief Unregister a previously registered callback
-   *
-   * @param callback The callback to unregister
-   */
-  void UnregisterEventCallback( CallbackBase* callback );
-
-protected: // Implementation of Processor
-
-  /**
-   * @copydoc Dali::Integration::Processor::Process()
-   */
-  void Process() override;
-
-private:
-
-  // Undefined
-  VectorAnimationManager( const VectorAnimationManager& manager ) = delete;
-
-  // Undefined
-  VectorAnimationManager& operator=( const VectorAnimationManager& manager ) = delete;
-
-private:
-
-  std::vector< CallbackBase* >             mEventCallbacks;
-  std::unique_ptr< VectorAnimationThread > mVectorAnimationThread;
-  bool                                     mProcessorRegistered;
-};
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_INTERNAL_VECTOR_ANIMATION_MANAGER_H
index c5978d6..bae4fbc 100644 (file)
@@ -26,7 +26,6 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/visuals/image-visual-shader-factory.h>
 #include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h>
-#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.h>
 
 namespace Dali
 {
@@ -53,7 +52,7 @@ VectorAnimationTask::VectorAnimationTask( VisualFactoryCache& factoryCache, cons
 : mUrl( url ),
   mVectorRenderer(),
   mAnimationData(),
-  mVectorAnimationThread( factoryCache.GetVectorAnimationManager().GetVectorAnimationThread() ),
+  mVectorAnimationThread( factoryCache.GetVectorAnimationThread() ),
   mConditionalWait(),
   mAnimationFinishedTrigger(),
   mPlayState( PlayState::STOPPED ),
index a9989c0..27ca01c 100644 (file)
 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
 #include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
 #include <dali-toolkit/internal/visuals/image-visual-shader-factory.h>
-#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali/devel-api/adaptor-framework/file-loader.h>
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/common/stage.h>
-#include <dali/devel-api/adaptor-framework/file-loader.h>
 #include <dali/integration-api/debug.h>
 
 namespace Dali
@@ -210,7 +209,6 @@ void SvgVisual::DoCreatePropertyMap( Property::Map& map ) const
     map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl.GetUrl() );
     map.Insert( Toolkit::ImageVisual::Property::ATLASING, mAttemptAtlasing );
   }
-  map.Insert( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, IsSynchronousLoadingRequired() );
 }
 
 void SvgVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
index c47cfca..69e859b 100755 (executable)
@@ -368,6 +368,7 @@ void Visual::Base::CreatePropertyMap( Property::Map& map ) const
   // which is ok, because they have a different key value range.
   map.Insert( Toolkit::Visual::Property::MIX_COLOR, mImpl->mMixColor ); // vec4
   map.Insert( Toolkit::Visual::Property::OPACITY, mImpl->mMixColor.a );
+  map.Insert( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, IsSynchronousLoadingRequired() );
 
   auto fittingModeString = Scripting::GetLinearEnumerationName< FittingMode >(
     mImpl->mFittingMode, VISUAL_FITTING_MODE_TABLE, VISUAL_FITTING_MODE_TABLE_COUNT );
index 7044e6d..2db3a57 100644 (file)
@@ -25,7 +25,6 @@
 #include <dali-toolkit/internal/visuals/color/color-visual.h>
 #include <dali-toolkit/internal/visuals/svg/svg-visual.h>
 #include <dali-toolkit/internal/visuals/image-atlas-manager.h>
-#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.h>
 
 namespace Dali
 {
@@ -38,7 +37,7 @@ namespace Internal
 
 VisualFactoryCache::VisualFactoryCache( bool preMultiplyOnLoad )
 : mSvgRasterizeThread( NULL ),
-  mVectorAnimationManager(),
+  mVectorAnimationThread(),
   mBrokenImageUrl(""),
   mPreMultiplyOnLoad( preMultiplyOnLoad )
 {
@@ -131,13 +130,14 @@ SvgRasterizeThread* VisualFactoryCache::GetSVGRasterizationThread()
   return mSvgRasterizeThread;
 }
 
-VectorAnimationManager& VisualFactoryCache::GetVectorAnimationManager()
+VectorAnimationThread& VisualFactoryCache::GetVectorAnimationThread()
 {
-  if( !mVectorAnimationManager )
+  if( !mVectorAnimationThread )
   {
-    mVectorAnimationManager = std::unique_ptr< VectorAnimationManager >( new VectorAnimationManager() );
+    mVectorAnimationThread = std::unique_ptr< VectorAnimationThread >( new VectorAnimationThread() );
+    mVectorAnimationThread->Start();
   }
-  return *mVectorAnimationManager;
+  return *mVectorAnimationThread;
 }
 
 void VisualFactoryCache::ApplyRasterizedSVGToSampler()
index 5fab354..18d4abc 100644 (file)
@@ -28,6 +28,7 @@
 #include <dali-toolkit/internal/visuals/npatch-loader.h>
 #include <dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h>
 #include <dali-toolkit/internal/visuals/texture-manager-impl.h>
+#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h>
 
 namespace Dali
 {
@@ -41,7 +42,6 @@ namespace Internal
 class ImageAtlasManager;
 class NPatchLoader;
 class TextureManager;
-class VectorAnimationManager;
 
 typedef IntrusivePtr<ImageAtlasManager> ImageAtlasManagerPtr;
 
@@ -215,10 +215,10 @@ public:
   SvgRasterizeThread* GetSVGRasterizationThread();
 
   /**
-   * Get the vector animation manager.
-   * @return A reference to the vector animation manager.
+   * Get the vector animation thread.
+   * @return A raw pointer pointing to the vector animation thread.
    */
-  VectorAnimationManager& GetVectorAnimationManager();
+  VectorAnimationThread& GetVectorAnimationThread();
 
 private: // for svg rasterization thread
 
@@ -243,14 +243,14 @@ private:
   Geometry mGeometry[GEOMETRY_TYPE_MAX+1];
   Shader mShader[SHADER_TYPE_MAX+1];
 
-  ImageAtlasManagerPtr                      mAtlasManager;
-  TextureManager                            mTextureManager;
-  NPatchLoader                              mNPatchLoader;
-  Texture                                   mBrokenImageTexture;
-  SvgRasterizeThread*                       mSvgRasterizeThread;
-  std::unique_ptr< VectorAnimationManager > mVectorAnimationManager;
-  std::string                               mBrokenImageUrl;
-  bool                                      mPreMultiplyOnLoad;
+  ImageAtlasManagerPtr                     mAtlasManager;
+  TextureManager                           mTextureManager;
+  NPatchLoader                             mNPatchLoader;
+  Texture                                  mBrokenImageTexture;
+  SvgRasterizeThread*                      mSvgRasterizeThread;
+  std::unique_ptr< VectorAnimationThread > mVectorAnimationThread;
+  std::string                              mBrokenImageUrl;
+  bool                                     mPreMultiplyOnLoad;
 };
 
 } // namespace Internal