2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h>
22 #include <dali/devel-api/adaptor-framework/window-devel.h>
23 #include <dali/devel-api/common/stage.h>
24 #include <dali/devel-api/rendering/renderer-devel.h>
25 #include <dali/integration-api/debug.h>
26 #include <dali/public-api/rendering/decorated-visual-renderer.h>
29 #include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-signals-devel.h>
30 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
31 #include <dali-toolkit/devel-api/visuals/visual-actions-devel.h>
32 #include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.h>
33 #include <dali-toolkit/internal/visuals/image-visual-shader-factory.h>
34 #include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
35 #include <dali-toolkit/internal/visuals/visual-factory-cache.h>
36 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
37 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
38 #include <dali-toolkit/public-api/visuals/visual-properties.h>
48 const int CUSTOM_PROPERTY_COUNT(1); // pixel area,
50 const Dali::Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
53 DALI_ENUM_TO_STRING_TABLE_BEGIN(STOP_BEHAVIOR)
54 DALI_ENUM_TO_STRING_WITH_SCOPE(Dali::Toolkit::DevelImageVisual::StopBehavior, CURRENT_FRAME)
55 DALI_ENUM_TO_STRING_WITH_SCOPE(Dali::Toolkit::DevelImageVisual::StopBehavior, FIRST_FRAME)
56 DALI_ENUM_TO_STRING_WITH_SCOPE(Dali::Toolkit::DevelImageVisual::StopBehavior, LAST_FRAME)
57 DALI_ENUM_TO_STRING_TABLE_END(STOP_BEHAVIOR)
60 DALI_ENUM_TO_STRING_TABLE_BEGIN(LOOPING_MODE)
61 DALI_ENUM_TO_STRING_WITH_SCOPE(Dali::Toolkit::DevelImageVisual::LoopingMode, RESTART)
62 DALI_ENUM_TO_STRING_WITH_SCOPE(Dali::Toolkit::DevelImageVisual::LoopingMode, AUTO_REVERSE)
63 DALI_ENUM_TO_STRING_TABLE_END(LOOPING_MODE)
65 #if defined(DEBUG_ENABLED)
66 Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_VECTOR_ANIMATION");
69 } // unnamed namespace
71 AnimatedVectorImageVisualPtr AnimatedVectorImageVisual::New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties)
73 AnimatedVectorImageVisualPtr visual(new AnimatedVectorImageVisual(factoryCache, shaderFactory, imageUrl));
74 visual->SetProperties(properties);
79 AnimatedVectorImageVisualPtr AnimatedVectorImageVisual::New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl)
81 AnimatedVectorImageVisualPtr visual(new AnimatedVectorImageVisual(factoryCache, shaderFactory, imageUrl));
86 AnimatedVectorImageVisual::AnimatedVectorImageVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl)
87 : Visual::Base(factoryCache, Visual::FittingMode::FILL, static_cast<Toolkit::Visual::Type>(Toolkit::DevelVisual::ANIMATED_VECTOR_IMAGE)),
90 mVectorAnimationTask(new VectorAnimationTask(factoryCache)),
91 mImageVisualShaderFactory(shaderFactory),
93 mVisualScale(Vector2::ONE),
95 mPlayState(DevelImageVisual::PlayState::STOPPED),
96 mEventCallback(nullptr),
98 mRendererAdded(false),
100 mRedrawInScalingDown(true)
102 // the rasterized image is with pre-multiplied alpha format
103 mImpl->mFlags |= Visual::Base::Impl::IS_PREMULTIPLIED_ALPHA;
105 mVectorAnimationTask->RequestLoad(mUrl.GetUrl());
107 mVectorAnimationTask->ResourceReadySignal().Connect(this, &AnimatedVectorImageVisual::OnResourceReady);
108 mVectorAnimationTask->SetAnimationFinishedCallback(new EventThreadCallback(MakeCallback(this, &AnimatedVectorImageVisual::OnAnimationFinished)));
110 auto& vectorAnimationManager = mFactoryCache.GetVectorAnimationManager();
111 vectorAnimationManager.AddObserver(*this);
114 AnimatedVectorImageVisual::~AnimatedVectorImageVisual()
118 auto& vectorAnimationManager = mFactoryCache.GetVectorAnimationManager();
119 vectorAnimationManager.RemoveObserver(*this);
123 mFactoryCache.GetVectorAnimationManager().UnregisterEventCallback(mEventCallback);
126 // Finalize animation task and disconnect the signal in the main thread
127 mVectorAnimationTask->ResourceReadySignal().Disconnect(this, &AnimatedVectorImageVisual::OnResourceReady);
128 mVectorAnimationTask->Finalize();
132 void AnimatedVectorImageVisual::VectorAnimationManagerDestroyed()
134 // Core is shutting down. Don't talk to the plugin any more.
135 mCoreShutdown = true;
138 void AnimatedVectorImageVisual::GetNaturalSize(Vector2& naturalSize)
140 if(mVisualSize != Vector2::ZERO)
142 naturalSize = mVisualSize;
146 if(mLoadFailed && mImpl->mRenderer)
148 // Load failed, use broken image size
149 auto textureSet = mImpl->mRenderer.GetTextures();
150 if(textureSet && textureSet.GetTextureCount())
152 auto texture = textureSet.GetTexture(0);
155 naturalSize.x = texture.GetWidth();
156 naturalSize.y = texture.GetHeight();
163 uint32_t width, height;
164 mVectorAnimationTask->GetDefaultSize(width, height);
165 naturalSize.x = width;
166 naturalSize.y = height;
170 DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::GetNaturalSize: w = %f, h = %f [%p]\n", naturalSize.width, naturalSize.height, this);
173 void AnimatedVectorImageVisual::DoCreatePropertyMap(Property::Map& map) const
176 map.Insert(Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::ANIMATED_VECTOR_IMAGE);
179 map.Insert(Toolkit::ImageVisual::Property::URL, mUrl.GetUrl());
181 map.Insert(Toolkit::DevelImageVisual::Property::LOOP_COUNT, mAnimationData.loopCount);
183 uint32_t startFrame, endFrame;
184 mVectorAnimationTask->GetPlayRange(startFrame, endFrame);
186 Property::Array playRange;
187 playRange.PushBack(static_cast<int32_t>(startFrame));
188 playRange.PushBack(static_cast<int32_t>(endFrame));
189 map.Insert(Toolkit::DevelImageVisual::Property::PLAY_RANGE, playRange);
191 map.Insert(Toolkit::DevelImageVisual::Property::PLAY_STATE, static_cast<int32_t>(mPlayState));
192 map.Insert(Toolkit::DevelImageVisual::Property::CURRENT_FRAME_NUMBER, static_cast<int32_t>(mVectorAnimationTask->GetCurrentFrameNumber()));
193 map.Insert(Toolkit::DevelImageVisual::Property::TOTAL_FRAME_NUMBER, static_cast<int32_t>(mVectorAnimationTask->GetTotalFrameNumber()));
195 map.Insert(Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR, mAnimationData.stopBehavior);
196 map.Insert(Toolkit::DevelImageVisual::Property::LOOPING_MODE, mAnimationData.loopingMode);
197 map.Insert(Toolkit::DevelImageVisual::Property::REDRAW_IN_SCALING_DOWN, mRedrawInScalingDown);
199 Property::Map layerInfo;
200 mVectorAnimationTask->GetLayerInfo(layerInfo);
201 map.Insert(Toolkit::DevelImageVisual::Property::CONTENT_INFO, layerInfo);
204 void AnimatedVectorImageVisual::DoCreateInstancePropertyMap(Property::Map& map) const
209 void AnimatedVectorImageVisual::EnablePreMultipliedAlpha(bool preMultiplied)
211 // Make always enable pre multiplied alpha whether preMultiplied value is false.
214 DALI_LOG_WARNING("Note : AnimatedVectorVisual cannot disable PreMultipliedAlpha\n");
218 void AnimatedVectorImageVisual::DoSetProperties(const Property::Map& propertyMap)
220 // url already passed in from constructor
221 for(Property::Map::SizeType iter = 0; iter < propertyMap.Count(); ++iter)
223 KeyValuePair keyValue = propertyMap.GetKeyValue(iter);
224 if(keyValue.first.type == Property::Key::INDEX)
226 DoSetProperty(keyValue.first.indexKey, keyValue.second);
230 if(keyValue.first == LOOP_COUNT_NAME)
232 DoSetProperty(Toolkit::DevelImageVisual::Property::LOOP_COUNT, keyValue.second);
234 else if(keyValue.first == PLAY_RANGE_NAME)
236 DoSetProperty(Toolkit::DevelImageVisual::Property::PLAY_RANGE, keyValue.second);
238 else if(keyValue.first == STOP_BEHAVIOR_NAME)
240 DoSetProperty(Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR, keyValue.second);
242 else if(keyValue.first == LOOPING_MODE_NAME)
244 DoSetProperty(Toolkit::DevelImageVisual::Property::LOOPING_MODE, keyValue.second);
246 else if(keyValue.first == REDRAW_IN_SCALING_DOWN_NAME)
248 DoSetProperty(Toolkit::DevelImageVisual::Property::REDRAW_IN_SCALING_DOWN, keyValue.second);
253 TriggerVectorRasterization();
256 void AnimatedVectorImageVisual::DoSetProperty(Property::Index index, const Property::Value& value)
260 case Toolkit::DevelImageVisual::Property::LOOP_COUNT:
263 if(value.Get(loopCount))
265 mAnimationData.loopCount = loopCount;
266 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_LOOP_COUNT;
270 case Toolkit::DevelImageVisual::Property::PLAY_RANGE:
272 const Property::Array* array = value.GetArray();
275 mAnimationData.playRange = *array;
276 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_RANGE;
280 case Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR:
282 int32_t stopBehavior = mAnimationData.stopBehavior;
283 if(Scripting::GetEnumerationProperty(value, STOP_BEHAVIOR_TABLE, STOP_BEHAVIOR_TABLE_COUNT, stopBehavior))
285 mAnimationData.stopBehavior = DevelImageVisual::StopBehavior::Type(stopBehavior);
286 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_STOP_BEHAVIOR;
290 case Toolkit::DevelImageVisual::Property::LOOPING_MODE:
292 int32_t loopingMode = mAnimationData.loopingMode;
293 if(Scripting::GetEnumerationProperty(value, LOOPING_MODE_TABLE, LOOPING_MODE_TABLE_COUNT, loopingMode))
295 mAnimationData.loopingMode = DevelImageVisual::LoopingMode::Type(loopingMode);
296 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_LOOPING_MODE;
300 case Toolkit::DevelImageVisual::Property::REDRAW_IN_SCALING_DOWN:
303 if(value.Get(redraw))
305 mRedrawInScalingDown = redraw;
312 void AnimatedVectorImageVisual::OnInitialize(void)
314 Shader shader = GenerateShader();
316 Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
318 mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
319 mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
321 TextureSet textureSet = TextureSet::New();
322 mImpl->mRenderer.SetTextures(textureSet);
324 // Register transform properties
325 mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
327 mVectorAnimationTask->SetRenderer(mImpl->mRenderer);
330 void AnimatedVectorImageVisual::DoSetOnScene(Actor& actor)
332 // Defer the rasterisation task until we get given a size (by Size Negotiation algorithm)
334 // Hold the weak handle of the placement actor and delay the adding of renderer until the rasterization is finished.
335 mPlacementActor = actor;
339 Vector2 imageSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector2>();
340 mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize);
341 actor.AddRenderer(mImpl->mRenderer);
342 ResourceReady(Toolkit::Visual::ResourceStatus::FAILED);
346 // Add property notification for scaling & size
347 mScaleNotification = actor.AddPropertyNotification(Actor::Property::WORLD_SCALE, StepCondition(0.1f, 1.0f));
348 mScaleNotification.NotifySignal().Connect(this, &AnimatedVectorImageVisual::OnScaleNotification);
350 mSizeNotification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition(3.0f));
351 mSizeNotification.NotifySignal().Connect(this, &AnimatedVectorImageVisual::OnSizeNotification);
353 DevelActor::VisibilityChangedSignal(actor).Connect(this, &AnimatedVectorImageVisual::OnControlVisibilityChanged);
355 Window window = DevelWindow::Get(actor);
358 DevelWindow::VisibilityChangedSignal(window).Connect(this, &AnimatedVectorImageVisual::OnWindowVisibilityChanged);
361 if(mImpl->mEventObserver)
363 // The visual needs it's size set before it can be rasterized hence request relayout once on stage
364 mImpl->mEventObserver->RelayoutRequest(*this);
367 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_NEED_RESOURCE_READY;
368 TriggerVectorRasterization();
371 DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOnScene [%p]\n", this);
374 void AnimatedVectorImageVisual::DoSetOffScene(Actor& actor)
381 actor.RemoveRenderer(mImpl->mRenderer);
382 mRendererAdded = false;
385 // Remove property notification
386 actor.RemovePropertyNotification(mScaleNotification);
387 actor.RemovePropertyNotification(mSizeNotification);
389 DevelActor::VisibilityChangedSignal(actor).Disconnect(this, &AnimatedVectorImageVisual::OnControlVisibilityChanged);
391 Window window = DevelWindow::Get(actor);
394 DevelWindow::VisibilityChangedSignal(window).Disconnect(this, &AnimatedVectorImageVisual::OnWindowVisibilityChanged);
397 mPlacementActor.Reset();
399 // Reset the visual size to zero so that when adding the actor back to stage the rasterization is forced
400 mVisualSize = Vector2::ZERO;
401 mVisualScale = Vector2::ONE;
402 mAnimationData.width = 0;
403 mAnimationData.height = 0;
405 DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOffScene [%p]\n", this);
408 void AnimatedVectorImageVisual::OnSetTransform()
410 Vector2 visualSize = mImpl->mTransform.GetVisualSize(mImpl->mControlSize);
412 if(IsOnScene() && visualSize != mVisualSize)
414 DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnSetTransform: width = %f, height = %f [%p]\n", visualSize.width, visualSize.height, this);
416 mVisualSize = visualSize;
418 SetVectorImageSize();
420 if(mPlayState == DevelImageVisual::PlayState::PLAYING && mAnimationData.playState != DevelImageVisual::PlayState::PLAYING)
422 mAnimationData.playState = DevelImageVisual::PlayState::PLAYING;
423 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE;
430 void AnimatedVectorImageVisual::UpdateShader()
434 Shader shader = GenerateShader();
435 mImpl->mRenderer.SetShader(shader);
439 void AnimatedVectorImageVisual::OnDoAction(const Property::Index actionId, const Property::Value& attributes)
441 // Check if action is valid for this visual type and perform action if possible
444 case DevelAnimatedVectorImageVisual::Action::PLAY:
446 if(IsOnScene() && mVisualSize != Vector2::ZERO)
448 if(mAnimationData.playState != DevelImageVisual::PlayState::PLAYING)
450 mAnimationData.playState = DevelImageVisual::PlayState::PLAYING;
451 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE;
454 mPlayState = DevelImageVisual::PlayState::PLAYING;
457 case DevelAnimatedVectorImageVisual::Action::PAUSE:
459 if(mAnimationData.playState == DevelImageVisual::PlayState::PLAYING)
461 mAnimationData.playState = DevelImageVisual::PlayState::PAUSED;
462 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE;
464 mPlayState = DevelImageVisual::PlayState::PAUSED;
467 case DevelAnimatedVectorImageVisual::Action::STOP:
469 if(mAnimationData.playState != DevelImageVisual::PlayState::STOPPED)
471 mAnimationData.playState = DevelImageVisual::PlayState::STOPPED;
472 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE;
474 mPlayState = DevelImageVisual::PlayState::STOPPED;
477 case DevelAnimatedVectorImageVisual::Action::JUMP_TO:
480 if(attributes.Get(frameNumber))
482 mAnimationData.currentFrame = frameNumber;
483 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_CURRENT_FRAME;
489 TriggerVectorRasterization();
492 void AnimatedVectorImageVisual::OnResourceReady(bool success)
494 mLoadFailed = !success;
496 // If weak handle is holding a placement actor, it is the time to add the renderer to actor.
497 Actor actor = mPlacementActor.GetHandle();
498 if(actor && !mRendererAdded)
502 actor.AddRenderer(mImpl->mRenderer);
503 ResourceReady(Toolkit::Visual::ResourceStatus::READY);
507 Vector2 imageSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector2>();
508 mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize);
509 actor.AddRenderer(mImpl->mRenderer);
510 ResourceReady(Toolkit::Visual::ResourceStatus::FAILED);
513 mRendererAdded = true;
515 DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "Renderer is added (success = %d) [%p]\n", success, this);
519 void AnimatedVectorImageVisual::OnAnimationFinished()
521 DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnAnimationFinished: action state = %d [%p]\n", mPlayState, this);
523 if(mPlayState != DevelImageVisual::PlayState::STOPPED)
525 mPlayState = DevelImageVisual::PlayState::STOPPED;
527 mAnimationData.playState = DevelImageVisual::PlayState::STOPPED;
529 if(mImpl->mEventObserver)
531 mImpl->mEventObserver->NotifyVisualEvent(*this, DevelAnimatedVectorImageVisual::Signal::ANIMATION_FINISHED);
537 mImpl->mRenderer.SetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED);
541 void AnimatedVectorImageVisual::SendAnimationData()
543 if(mAnimationData.resendFlag)
545 mVectorAnimationTask->SetAnimationData(mAnimationData);
549 if(mAnimationData.playState == DevelImageVisual::PlayState::PLAYING)
551 mImpl->mRenderer.SetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY);
555 mImpl->mRenderer.SetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED);
559 mAnimationData.resendFlag = 0;
563 void AnimatedVectorImageVisual::SetVectorImageSize()
565 uint32_t width = static_cast<uint32_t>(mVisualSize.width * mVisualScale.width);
566 uint32_t height = static_cast<uint32_t>(mVisualSize.height * mVisualScale.height);
568 if(mAnimationData.width != width || mAnimationData.height != height)
570 mAnimationData.width = width;
571 mAnimationData.height = height;
572 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_SIZE;
576 void AnimatedVectorImageVisual::StopAnimation()
578 if(mAnimationData.playState != DevelImageVisual::PlayState::STOPPED)
580 mAnimationData.playState = DevelImageVisual::PlayState::STOPPED;
581 mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE;
583 mPlayState = DevelImageVisual::PlayState::STOPPED;
587 void AnimatedVectorImageVisual::TriggerVectorRasterization()
589 if(!mEventCallback && !mCoreShutdown)
591 mEventCallback = MakeCallback(this, &AnimatedVectorImageVisual::OnProcessEvents);
592 auto& vectorAnimationManager = mFactoryCache.GetVectorAnimationManager();
593 vectorAnimationManager.RegisterEventCallback(mEventCallback);
594 Stage::GetCurrent().KeepRendering(0.0f); // Trigger event processing
598 void AnimatedVectorImageVisual::OnScaleNotification(PropertyNotification& source)
600 Actor actor = mPlacementActor.GetHandle();
603 Vector3 scale = actor.GetProperty<Vector3>(Actor::Property::WORLD_SCALE);
605 if((mVisualScale.width != scale.width || mVisualScale.height != scale.height) && (mRedrawInScalingDown || scale.width >= 1.0f || scale.height >= 1.0f))
607 mVisualScale.width = scale.width;
608 mVisualScale.height = scale.height;
610 DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnScaleNotification: scale = %f, %f [%p]\n", mVisualScale.width, mVisualScale.height, this);
612 SetVectorImageSize();
615 Stage::GetCurrent().KeepRendering(0.0f); // Trigger event processing
620 void AnimatedVectorImageVisual::OnSizeNotification(PropertyNotification& source)
622 Actor actor = mPlacementActor.GetHandle();
625 Vector3 size = actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE);
627 if(mVisualSize.width != size.width || mVisualSize.height != size.height)
629 mVisualSize.width = size.width;
630 mVisualSize.height = size.height;
632 DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnSizeNotification: size = %f, %f [%p]\n", mVisualSize.width, mVisualSize.height, this);
634 SetVectorImageSize();
637 Stage::GetCurrent().KeepRendering(0.0f); // Trigger event processing
642 void AnimatedVectorImageVisual::OnControlVisibilityChanged(Actor actor, bool visible, DevelActor::VisibilityChange::Type type)
647 TriggerVectorRasterization();
649 DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnControlVisibilityChanged: invisibile. Pause animation [%p]\n", this);
653 void AnimatedVectorImageVisual::OnWindowVisibilityChanged(Window window, bool visible)
658 TriggerVectorRasterization();
660 DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnWindowVisibilityChanged: invisibile. Pause animation [%p]\n", this);
664 void AnimatedVectorImageVisual::OnProcessEvents()
668 mEventCallback = nullptr; // The callback will be deleted in the VectorAnimationManager
671 Shader AnimatedVectorImageVisual::GenerateShader() const
674 if(mImpl->mCustomShader)
676 shader = Shader::New(mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource().data() : mImpl->mCustomShader->mVertexShader,
677 mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource().data() : mImpl->mCustomShader->mFragmentShader,
678 mImpl->mCustomShader->mHints);
680 shader.RegisterProperty(PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT);
684 shader = mImageVisualShaderFactory.GetShader(
686 ImageVisualShaderFeature::FeatureBuilder()
687 .EnableRoundedCorner(IsRoundedCornerRequired())
688 .EnableBorderline(IsBorderlineRequired()));
693 } // namespace Internal
695 } // namespace Toolkit