The magic number kappa (0.552284), which is associated with the bezier curve,
has been introduced. This formula is supposed to be applied to the rounded corners
of the rectangle to ensure consistent drawing results.
Issue: https://github.com/thorvg/thorvg/issues/1824
There are some matting masking bugs observed,
Reverted the commit. We will revisit it later.
commit d37c500262
Author: Hermet Park <hermet@lottiefiles.com>
Date: Wed Oct 25 18:55:05 2023 +0900
lottie: introduced static layer cache.
lottie builder doesn't need to rebuild the layer object
if it has no any animation frame data.
That case, we can cache the layer scene in order to reuse it.
Tested on local machine (single thread):
- Lottie: appx. 2ms enhanced.
- Binary: +204
Basic shapes were trimmed entirely when they were outside of the canvas,
even if they had a big enough stroke to be partially on the canvas.
This fixes the issue.
Issue: https://github.com/thorvg/thorvg/issues/1785
Currently, it assumes "ty":"gr" for the related shapes children,
which can be skipped since the children will be in the "it" scope.
Some Lottie data is missing the "ty":"gr" field,
and ThorVG couldn't display the content properly.
It can ignore it with the context understanding.
Previously, Picture::load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false)
would return 'Success' even when the data is invalid.
This issue only occurred when the number of threads is set to 0.
this fixes the memory sanitizer report:
../src/savers/gif/gif.h:315:31: runtime error: index 255 out of bounds for type 'unsigned char [255]'
../src/savers/gif/gif.h:113:54: runtime error: index 255 out of bounds for type 'unsigned char [255]'
Issue: https://github.com/thorvg/thorvg/issues/1758
Add save() API that takes tvg::Animation as a parameter.
This API uses gif.h to create each animation frame as a gif frame.
Gif creation do not support threads because they must be added sequentially.
Please see example/GifSaver.cpp
ex)
auto animation = tvg::Animation::gen();
auto picture = animation->picture();
picture->load(EXAMPLE_DIR"/walker.json");
auto saver = tvg::Saver::gen();
saver->save(std::move(animation), EXAMPLE_DIR"/test.gif");
saver->sync();
New API:
Result Saver::save(std::unique_ptr<Animation> animation, const std::string& path, uint32_t quality = 100, uint32_t fps = 0);
Issue: https://github.com/thorvg/thorvg/issues/1712
../src/loaders/external_png/tvgPngLoader.cpp(110): warning C4244: '=': conversion from 'float' to 'uint32_t', possible loss of data
../src/loaders/external_png/tvgPngLoader.cpp(111): warning C4244: '=': conversion from 'float' to 'uint32_t', possible loss of data
../src/loaders/external_png/tvgPngLoader.cpp(112): warning C4244: '=': conversion from 'float' to 'uint32_t', possible loss of data
The Animation::frame() method has been modified.
It will now return InsufficientCondition,
if the frame value is the same as the previous one.
In addition to this change, we have also updated its usage accordingly.
Get rid of the polymorphism function table,
use the switch directly instead.
We profiled, both binary & performance is better than before.
Tested on a local machine (single thread):
- Lottie: 2ms improved
- Binary: -0.5kb
lottie builder doesn't need to rebuild the layer object
if it has no any animation frame data.
That case, we can cache the layer scene in order to reuse it.
Tested on local machine (single thread):
- Lottie: appx. 2ms enhanced.
- Binary: +204
replace the frame count unit from the int32_t to float
since animations could smoothly interpolate key-frames.
This notificably improve the animation smoothness in Lottie
Beta API changes:
Result Animation::frame(uint32_t no) -> Result Animation::frame(float no)
uint32_t Animation::curFrame() const -> float Animation::curFrame() const
uint32_t Animation::totalFrame() const -> float Animation::totalFrame() const
Unified common logic for scaled image raster operations,
Avoid on-spot pixel computation as possible.
Tested on local machine (single thread)
Lottie: 0.057s -> 0.053s (-0.004s)
Try to minimize the use of sqrt() and arctan() calls
when possible. These calls can be relatively expensive
when accumulated within a single frame.
Also repalce the division with shift operation.
since split cubic function is one of the significant hot-spots
in the data processing, we could earn a noticable enhancement.
Tested on single thread local machine:
Lottie: 0.080 -> 0.052s (-0.028s)
Performance: 0.023 -> 0.022 (-0.001s)
Binary: +34
Streamlining computations with floating-point operations in rotation
thereby improving 'thorvg' speed.
Also use the well-optimized posix math functions instead of
custom math.
Test on my local machine.
Lottie: -0.008s (0.073 -> 0.065)
Performance: -0.0013s (0.0154 -> 0.0141)
Binary: -323