#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
{
${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
#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
{
#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
#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
{
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;
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
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.
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;
}
}
}
}
-void AnimatedVectorImageVisual::OnProcessEvents()
-{
- SendAnimationData();
-
- mEventCallback = nullptr; // The callback will be deleted in the VectorAnimationManager
-}
-
} // namespace Internal
} // namespace Toolkit
#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>
* | url | STRING |
*
*/
-class AnimatedVectorImageVisual: public Visual::Base, public ConnectionTracker
+class AnimatedVectorImageVisual: public Visual::Base, public ConnectionTracker, public Integration::Processor
{
public:
*/
void OnDoAction( const Property::Index actionId, const Property::Value& attributes ) override;
+protected: // Implementation of Processor
+
+ /**
+ * @copydoc Dali::Integration::Processor::Process()
+ */
+ void Process() override;
+
private:
/**
*/
void OnWindowVisibilityChanged( Window window, bool visible );
- /**
- * @brief Callback when the event is processed.
- */
- void OnProcessEvents();
-
// Undefined
AnimatedVectorImageVisual( const AnimatedVectorImageVisual& visual ) = delete;
Vector2 mVisualScale;
WeakHandle< Actor > mPlacementActor;
DevelImageVisual::PlayState::Type mPlayState;
- CallbackBase* mEventCallback; // Not owned
bool mRendererAdded;
+ bool mRasterizationTriggered;
};
} // namespace Internal
+++ /dev/null
-/*
- * 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
+++ /dev/null
-#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
// 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
{
: mUrl( url ),
mVectorRenderer(),
mAnimationData(),
- mVectorAnimationThread( factoryCache.GetVectorAnimationManager().GetVectorAnimationThread() ),
+ mVectorAnimationThread( factoryCache.GetVectorAnimationThread() ),
mConditionalWait(),
mAnimationFinishedTrigger(),
mPlayState( PlayState::STOPPED ),
#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
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
// 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 );
#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
{
VisualFactoryCache::VisualFactoryCache( bool preMultiplyOnLoad )
: mSvgRasterizeThread( NULL ),
- mVectorAnimationManager(),
+ mVectorAnimationThread(),
mBrokenImageUrl(""),
mPreMultiplyOnLoad( preMultiplyOnLoad )
{
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()
#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
{
class ImageAtlasManager;
class NPatchLoader;
class TextureManager;
-class VectorAnimationManager;
typedef IntrusivePtr<ImageAtlasManager> ImageAtlasManagerPtr;
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
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