Implemented the ability to revert Lottie slots by calling override with nullptr.
This functionality allows for the complete reversal of applied slots.
usage:
- `animation->override(nullptr)`
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
When image data fails to load or image parsing fails,
the id is leaked without being assigned to the name.
To prevent that, free id value when obj is nullptr.
related issue: https://github.com/thorvg/thorvg/issues/2072
BrokenLottie.7z/test3_IDX_130_RAND_18289244608080059871.json
BrokenLottie.7z/test3_IDX_131_RAND_7772102071213376276.json
BrokenLottie.7z/test3_IDX_132_RAND_3072617087893397532.json
BrokenLottie.7z/test3_IDX_134_RAND_17738488813555566674.json
BrokenLottie.7z/test3_IDX_137_RAND_13903188963759129023.json
BrokenLottie.7z/test3_IDX_138_RAND_1645404078965858130.json
* Support rendering Gradient in path Stroke mode
* Fix GlStencilCoverTask not support even-odd fill rule
* Make GlStencilCoverTask can discard overlapped area during stroke
rendering
When json file is invalid in the parser,
the LottieComposition object is not released and the parse() returns false.
To prevent memory leaks, free the memory before returning false.
related issue : https://github.com/thorvg/thorvg/issues/2070
This commit addresses an issue where paints lost their
composition context when drawings occurred without any updates.
Now, paints will consistently retain the composition context,
ensuring accurate rendering.
Issue: https://github.com/thorvg/thorvg/issues/2058
Enhances the portability of the TTF loader on UWP platforms
by implementing an alternative file loading mechanism.
This is designed to support environments where the file mapping
feature is not available, ensuring wider compatibility and reliability
in file handling.
Issue: https://github.com/thorvg/thorvg/issues/1912
[issues 1479: FillRule](#1479)
Introduced fill rule winding
This rule makes sense only if path have some self intersections.
In all other cases shapes are filled by even-odd behavor.
error: storing the address of local variable 'context' in '*this.LottieParser::context' [-Werror=dangling-pointer=]
1255 | this->context = &context;
issue: https://github.com/thorvg/thorvg/issues/2051
Refactor the GlCanvas::target() interface to allow
passing the drawing target ID from the user side.
Previously, it performed the drawing on the currently set FBO target.
Beta API change:
Result GlCanvas::target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h)
-> Result GlCanvas::target(int32_t id, uint32_t w, uint32_t h)
* use GLRenderBuffer in color and stencil attachment, also use x4 sample
count by default.
* add msaa resolve logical at the end of a ComposeTask, so the normal
color texture can get the final rendering result.
sw_engine: radial gradient
[issues 2014: radial gradient](#2014)
Radial gradient results in a corrupted image when the focal point is outside the circle on Apple Silicon.
This happens because some compilers use FMA to optimize the a = dr² - dx² - dy² calculation,
which cause loss of precision.
We rely on temporary variables to prevent FMA.
We could also use compiler specific float contraction control pragmas to avoid this if this doesn't work in the future
Since we choose MSAA, no need to calculate edge alpha during fragment
stage. So this commit removed the alpha attribute and related code:
* Remove the alpha attribute in vertex data.
* Change position type from `vec3` to `vec2` in all shader code.
* Remove alhpa multiplication in all fragment shaders
The previous loader cache mechanism encountered a problem
when the user changed the content of the cached data.
In such cases, a new request would not be processed
because the renderer would use the previously cached content.
So far, the TVG cache mechanism utilizes a pointer hash key
for the fastest hashing mechanism available.
One limitation is that it assumes the address is unique for the data.
To resolve this, we modified the caching policy.
Now, the renderer will not cache copied data;
it will only cache the given data when it is deemed shareable.
issue: https://github.com/thorvg/thorvg/issues/2020
[issues 1479: antialiasing](#1479)
Anti-aliasing implementation
Implements antialiasing as a post process on cimpute shaders and original render target with scale of 2x.
Can be modified as an external settings
Since we choose multisample antialiasing, use stencil then cover to
render polygon can get better performance.
Also the code is much easier to understand.
After introducing the length measurement
of approximate and exact Bezier curves in
a8c0030d80
the calculation of the outline length still
used the approximate functions, while further
calculations took the exact value into account.
This discrepancy led to the creation of artifacts.
@Issue: https://github.com/thorvg/thorvg/issues/2021
stroke line drawing has been broken at a certain case,
this reverts a part of change from the old optimization:
d81f5d29fb
note that this change wouldn't affect any performance.
issue: https://github.com/thorvg/thorvg/issues/2015