/*
- * Copyright (c) 2022 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.
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
#include <dali/devel-api/adaptor-framework/vector-animation-renderer.h>
#include <dali/devel-api/threading/mutex.h>
+#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/object/property-array.h>
#include <toolkit-application.h>
#include <toolkit-event-thread-callback.h>
#include <toolkit-vector-animation-renderer.h>
mFrameRate(60.0f),
mTestFrameDrop(false),
mNeedDroppedFrames(false),
+ mUseNativeImage(false),
mEventThreadCallback(new EventThreadCallback(MakeCallback(this, &VectorAnimationRenderer::OnTriggered)))
{
mCount++;
mDynamicPropertyCallback = std::unique_ptr<CallbackBase>(callback);
}
+ void KeepRasterizedBuffer()
+ {
+ Dali::Mutex::ScopedLock lock(mMutex);
+ mEnableFixedCache = true;
+ }
+
Dali::VectorAnimationRenderer::UploadCompletedSignalType& UploadCompletedSignal()
{
return mUploadCompletedSignal;
mResourceReady = true;
Dali::TextureSet textureSet = mRenderer.GetTextures();
- Dali::Texture texture = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, mWidth, mHeight);
- textureSet.SetTexture(0, texture);
- Devel::PixelBuffer pixelBuffer = Devel::PixelBuffer::New(mWidth, mHeight, Pixel::RGBA8888);
- Dali::PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer);
- texture.Upload(pixelData);
+ if(mUseNativeImage)
+ {
+ Dali::NativeImageSourcePtr nativeImageSource = Dali::NativeImageSource::New(mWidth, mHeight, Dali::NativeImageSource::COLOR_DEPTH_32);
+ Dali::Texture texture = Dali::Texture::New(*nativeImageSource);
+ textureSet.SetTexture(0, texture);
+ }
+ else
+ {
+ Dali::Texture texture = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, mWidth, mHeight);
+ textureSet.SetTexture(0, texture);
+
+ Devel::PixelBuffer pixelBuffer = Devel::PixelBuffer::New(mWidth, mHeight, Pixel::RGBA8888);
+ Dali::PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer);
+ texture.Upload(pixelData);
+ }
mUploadCompletedSignal.Emit();
}
bool mLoadFailed{false};
bool mResourceReady{false};
bool mNeedTrigger{true};
+ bool mEnableFixedCache{false};
+ bool mUseNativeImage{false};
Dali::VectorAnimationRenderer::UploadCompletedSignalType mUploadCompletedSignal;
std::unique_ptr<EventThreadCallback> mEventThreadCallback;
return Internal::Adaptor::GetImplementation(*this).GetMarkerInfo(marker, startFrame, endFrame);
}
+void VectorAnimationRenderer::GetMarkerInfo(Property::Map& map) const
+{
+ map.Add(VECTOR_ANIMATION_MARKER_NAME_1, Property::Array({VECTOR_ANIMATION_MARKER_START_FRAME_1, VECTOR_ANIMATION_MARKER_END_FRAME_1}));
+ map.Add(VECTOR_ANIMATION_MARKER_NAME_2, Property::Array({VECTOR_ANIMATION_MARKER_START_FRAME_2, VECTOR_ANIMATION_MARKER_END_FRAME_2}));
+}
+
void VectorAnimationRenderer::InvalidateBuffer()
{
return Internal::Adaptor::GetImplementation(*this).InvalidateBuffer();
Internal::Adaptor::GetImplementation(*this).AddPropertyValueCallback(keyPath, property, callback, id);
}
+void VectorAnimationRenderer::KeepRasterizedBuffer()
+{
+ Internal::Adaptor::GetImplementation(*this).KeepRasterizedBuffer();
+}
+
VectorAnimationRenderer::UploadCompletedSignalType& VectorAnimationRenderer::UploadCompletedSignal()
{
return Internal::Adaptor::GetImplementation(*this).UploadCompletedSignal();
return Dali::Internal::Adaptor::gVectorAnimationRenderer->mDroppedFrames;
}
+void UseNativeImageTexture(bool useNativeImage)
+{
+ Dali::Internal::Adaptor::gVectorAnimationRenderer->mUseNativeImage = useNativeImage;
+}
+
} // namespace VectorAnimationRenderer
} // namespace Test