#define DALI_VECTOR_ANIMATION_RENDERER_TIZEN_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
void OnFinalize() override;
/**
- * @brief Event callback to process events.
- */
- void OnLottieRendered() override
- {
- }
-
- /**
* @copydoc VectorAnimationRenderer::OnNotify()
*/
void OnNotify() override;
std::vector<SurfacePair> mBuffers; ///< EGL Image vector
- Dali::Texture mRenderedTexture; ///< Rendered Texture
- std::vector<Dali::Texture> mPreviousTextures; ///< Previous rendered texture
+ Dali::Texture mRenderedTexture; ///< Rendered Texture
+ std::vector<Dali::Texture> mPreviousTextures; ///< Previous rendered texture
};
} // namespace Plugin
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
};
VectorAnimationRendererX::VectorAnimationRendererX()
-: mRenderCallback(std::unique_ptr<EventThreadCallback>(new EventThreadCallback(MakeCallback(this, &VectorAnimationRendererX::OnLottieRendered))))
+: mUploadPixelBufferRequired(false)
{
}
}
mVectorRenderer->renderSync(frameNumber, renderingDataImpl->mLottieSurface);
- mRenderCallback->Trigger();
+
+ mUploadPixelBufferRequired = true;
if(!mResourceReady)
{
mResourceReady = true;
mResourceReadyTriggered = true;
-
- VectorAnimationPluginManager::Get().TriggerEvent(*this);
}
+ VectorAnimationPluginManager::Get().TriggerEvent(*this);
+
return true;
}
{
}
-void VectorAnimationRendererX::OnLottieRendered()
+// This Method is called inside mMutex
+void VectorAnimationRendererX::OnNotify()
{
+ // Skip Upload operation if we don't need.
+ if(!mUploadPixelBufferRequired)
+ {
+ return;
+ }
+
std::shared_ptr<RenderingDataImpl> renderingDataImpl;
{
Dali::Mutex::ScopedLock lock(mRenderingDataMutex);
renderingDataImpl = std::static_pointer_cast<RenderingDataImpl>(mCurrentRenderingData);
}
- Dali::Mutex::ScopedLock lock(mMutex);
if(renderingDataImpl && renderingDataImpl->mPixelBuffer && renderingDataImpl->mTexture)
{
PixelData pixelData = renderingDataImpl->mPixelBuffer.CreatePixelData();
renderingDataImpl->mTexture.Upload(pixelData);
- }
-}
-// This Method is called inside mMutex
-void VectorAnimationRendererX::OnNotify()
-{
+ mUploadPixelBufferRequired = false;
+ }
}
// This Method is called inside mRenderingDataMutex
void VectorAnimationRendererX::PrepareTarget(std::shared_ptr<RenderingData> renderingData)
{
std::shared_ptr<RenderingDataImpl> renderingDataImpl = std::static_pointer_cast<RenderingDataImpl>(renderingData);
- renderingDataImpl->mTexture = Texture::New(Dali::TextureType::TEXTURE_2D, Dali::Pixel::BGRA8888, renderingDataImpl->mWidth, renderingDataImpl->mHeight);
- renderingDataImpl->mPixelBuffer = Dali::Devel::PixelBuffer::New(renderingDataImpl->mWidth, renderingDataImpl->mHeight, Dali::Pixel::BGRA8888);
- renderingDataImpl->mLottieSurface = rlottie::Surface(reinterpret_cast<uint32_t*>(renderingDataImpl->mPixelBuffer.GetBuffer()), renderingDataImpl->mWidth, renderingDataImpl->mHeight, static_cast<size_t>(renderingDataImpl->mPixelBuffer.GetStride() * 4));
+ renderingDataImpl->mTexture = Texture::New(Dali::TextureType::TEXTURE_2D, Dali::Pixel::BGRA8888, renderingDataImpl->mWidth, renderingDataImpl->mHeight);
+ renderingDataImpl->mPixelBuffer = Dali::Devel::PixelBuffer::New(renderingDataImpl->mWidth, renderingDataImpl->mHeight, Dali::Pixel::BGRA8888);
+ renderingDataImpl->mLottieSurface = rlottie::Surface(reinterpret_cast<uint32_t*>(renderingDataImpl->mPixelBuffer.GetBuffer()), renderingDataImpl->mWidth, renderingDataImpl->mHeight, static_cast<size_t>(renderingDataImpl->mPixelBuffer.GetStride() * 4));
}
// This Method is called inside mRenderingDataMutex
#define DALI_VECTOR_ANIMATION_RENDERER_X_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
*/
// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
void OnFinalize() override;
/**
- * @brief Event callback to process events.
- */
- void OnLottieRendered() override;
-
- /**
* @copydoc VectorAnimationRenderer::OnNotify()
*/
void OnNotify() override;
* @note This Method is called inside mRenderingDataMutex
*/
void OnSetSize(std::shared_ptr<RenderingData> renderingData) override
- {}
+ {
+ }
/**
* @copydoc VectorAnimationRenderer::IsTargetPrepared()
std::shared_ptr<RenderingData> CreateRenderingData() override;
private:
- std::unique_ptr<EventThreadCallback> mRenderCallback; ///
+ bool mUploadPixelBufferRequired;
};
} // namespace Plugin
#define DALI_EXTENSION_VECTOR_ANIMATION_RENDERER_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
void NotifyEvent() override;
protected:
-
class RenderingData
{
public:
virtual void OnFinalize() = 0;
/**
- * @brief Event callback to process events.
- */
- virtual void OnLottieRendered() = 0;
-
- /**
* @brief Notify event thread comes
*/
virtual void OnNotify() = 0;