Commit graph

2747 commits

Author SHA1 Message Date
Mira Grudzinska
37f7c962c6 test: fix margin value
The precision margin for the comparison
has been set to 0.01f instead of 004004.
2024-05-17 11:01:26 +09:00
Jinny You
83eb8ba37b lottie/slot: Fix slot resetting bug
When resetting back to animated property, system causes an UAF because frames have been freed.

Mark frames in nullptr at the case, so it doesn't use frame data after freed.

Issue: #2255
2024-05-17 11:01:09 +09:00
Hermet Park
6235068cad bump up version v0.13.3 2024-05-10 11:16:21 +09:00
Hermet Park
bd0d95d2f9 lottie: fixed a memory leak
Free the children data properly,
rarely observerd this, only when a layer is hidden.
2024-05-10 11:16:21 +09:00
Hermet Park
8743ecf868 common: tweaking bezier computation for perf.
It will sacrifice precision that is not noticeable
and instead try to improve performance.

Approximately 5% has beeen improved at Lottie example
2024-05-10 11:16:21 +09:00
Hermet Park
e618dbf0f8 lottie: code refactoring.
text tracking is an optional property.
it's good to initialize it with 0.
2024-05-10 11:16:21 +09:00
Jinny You
3fdd699a76 lottie/text: Support text tracking
Text Tracking value("tr") is parsed and never used.

Calculate text spacing size via the tracking offset.

Issue: #2254
2024-05-10 11:16:21 +09:00
Hermet Park
32bbd03672 common/array: ++safety
do not try memory copy if the size is 0.
2024-05-10 11:16:21 +09:00
Mira Grudzinska
94751654b4 svg_loader: move the display property to the style
The display property, like any other node's style property,
should be part of a node style. This ensures its correct
copying and inheritance.
For the 'symbol' node, which is not rendered unless it is
used within a 'use' node, the display property can also be
applied. Because of that it cannot be utilized during scene
construction to determine whether the symbol is being defined
or used within a 'use' context.
2024-05-10 11:16:21 +09:00
Hermet Park
522fa49e76 lottie/expressions: fix a build break on windows. 2024-05-10 11:16:21 +09:00
Hermet Park
e5213c450f lottie/expressions: fixed a memory access violation.
Reset memory after freeing the singletone instance.
2024-05-10 11:16:21 +09:00
Hermet Park
0a181dc734 test: corrected wrong implementation.
identifier should have been methods.
2024-05-10 11:16:21 +09:00
Hermet Park
3a855b6119 infra: add extra build options for flexible ThorVG composition
this commit introduces an additional build options:

- lottie expressions: this advanced feature in Lottie can
significantly increase binary size. Users now have the option
to enable or disable it based on their requirements.

Note that, this change introduces one config definitions:

- THORVG_LOTTIE_EXPRESSIONS_SUPPORT
2024-05-10 11:16:18 +09:00
Mira Grudzinska
abef4c724f common: fix a precision issue in appendArc api
For angles close to multiples of pi/2, precision
based on FLT_EPSILON was insufficient. It either
led to the creation of an additional cubic segment
filled with erroneous values or NaNs, or it resulted
in the drawing of an angle for a sweep close to 0.
2024-05-10 11:12:12 +09:00
5d2d48e32a sw_engine/neon: arm neonRasterPixel32 function to support aarch64
Improved the speed through neon processing.

Improvements Rate:
Lottie: (0.026321/0.026779) = +1.8%
Performance: (0.015411/0.015732) = +2.1%

issue: https://github.com/thorvg/thorvg/issues/30
2024-05-10 11:12:12 +09:00
Mira Grudzinska
407c8b7cfb svg_loader: paintOrder property properly copied
The paintOrder property set by the style was
not being copied. Now fixed.
2024-05-10 11:12:12 +09:00
a3a860b361 sw_engine : arm neonRasterGrayscale8 function to support aarch64
Improved the speed through neon processing.

Improvements Rate:
Lottie: (0.025986/0.026201) = +4.7%
Performance: (0.014163/0.014785) = +4.3%

issue: https://github.com/thorvg/thorvg/issues/30
2024-05-10 11:12:12 +09:00
Hermet Park
0bef7747a5 lottie/expressions: minor size down expressions engine.
- disable unused builtin realm functions.
- disable global this
- disable regexp (potential)
- disable unicode case conversion (potential)

Some features are marked with (potential)
since we are not certain these are used practically.

until now, total binary size diff by expressions: +287kb
2024-05-10 11:12:12 +09:00
Hermet Park
8fb60c11bb lottie/expressions: ++exceptional handling
Stop handling if the interpreting result is invalid.
2024-05-10 11:12:12 +09:00
Hermet Park
fc67a39c78 lottie/expressions: apply expressions to missing properites. 2024-05-10 11:12:12 +09:00
Hermet Park
25c0f32e8a lottie/expressions: enhance stability
When the system fails to interpret the expression code,
it forcibly disables the feature per property.

This improvement enhances stability and performance
by avoiding reckless attempts to interpret JavaScript code.

When we confirm the full stability with expressions,
we can revert this code.
2024-05-10 11:12:12 +09:00
Hermet Park
7bb8d60097 lottie/expressions: ++exceptional handling.
Add an exceptional handling if interpreting code is failed.
2024-05-10 11:12:12 +09:00
Hermet Park
6959523ee7 lottie/expressions: make it up the insufficient content() behavior
this is a follow-up fix for the initial expressions feature.
2024-05-10 11:12:12 +09:00
Hermet Park
34b2e3ba37 lottie: fix a logic by a mistake. 2024-05-10 11:12:12 +09:00
Vincent Torri
3eb3364c60 infra: fix build failure using c++17 (or later) with MSVC.
the WIN32_LEAN_AND_MEAN definition will remove the unused
features in windows.h that helps to improve the build-speed
as well as fixing the issue.

Issue: https://github.com/thorvg/thorvg/issues/2225

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2024-05-10 11:12:12 +09:00
Jinny You
51e3d25043 bindings/capi: Fix incompatible parameter
C API doesn't support default parameter, removed it.

Issue: #2228
2024-05-10 11:12:12 +09:00
Jinny You
4d7ff092a5 test/lottie: Add the segment use case 2024-05-10 11:12:09 +09:00
Hermet Park
4135f83026 doc: adds the api version history 2024-05-10 10:47:01 +09:00
Hermet Park
faa49ba2da lottie/jerryscript - size down the engine.
get rid of unused features in thorvg lottie.
2024-05-10 10:46:53 +09:00
Hermet Park
289aada0fd lottie: support the expression feature
The current development of the expression engine is experimental.
It does not support multi-threading.

Therefore, when tvg::Initializer::init() is configured
with more than one thread, expressions will be automatically disabled.

issue: https://github.com/thorvg/thorvg/issues/1640
2024-05-10 10:46:21 +09:00
Hermet Park
87320436db lottie/model: Added some essential functions through expressions.
These internal methods have been introduced to search for content within
an object (parent) using a given parameter (name or index).

- LottieLayer* LottieGroup::asset(const char* name)
- LottieLayer* LottieComposition::asset(const char* name)
- LottieLayer* LottieComposition::layer(uint16_t id)
- LottieLayer* LottieComposition::layer(const char* name)

This converts the frame number to the corresponding time.
- float LottieComposition::timeAtFrame(float frameNo)
2024-05-10 10:42:12 +09:00
Hermet Park
5a8e15aebd lottie: ++binary search stability.
this ensures that the return value is not below 0,
when the frame count is just 2.
2024-05-10 10:42:05 +09:00
Hermet Park
9e6a837125 lottie: specify the explicit parsing type.
these explicit type values are expected
to be referenced by the expressions.
2024-05-10 10:41:59 +09:00
Hermet Park
1ccf14808b lottie: generalize parent context access in parsing.
ensure parent context is generally accessible,
not limited to gradients.
2024-05-10 10:41:53 +09:00
Hermet Park
8488c629eb lottie: integrate JerryScript engine for expressions
introduced the JerryScript engine to interpret Lottie
expressions, enhancing the capability to support runtime
programmable animation logic within Lottie expressions
spec. This feature, based on js scripting, represents
the most complicated addition to the Lottie spec so far.

ThorVG probably could includes an option to toggle
this feature at build time, allowing for customizable user
configurations according to specific requirements.

removed unused features for the optimal size:
- DEBUGGER
- MEM_STATS
- SNAPSHOT
- BUILTIN_JSON
- BUILTIN_PROXY
- BUILTIN_REFLECT
- BUILTIN_ATOMICS
- PROMISE_CALLBACK
- MODULE_SYSTEM
- SYSTEM_PORT

This is an experimental version.
Please manually enable the 'lottie-expressions' in meson.build
when you wish to use it.

See: https://jerryscript.net/
2024-05-10 10:41:22 +09:00
Hermet Park
5237d0868e bump up version v0.13.2 2024-04-26 11:26:54 +09:00
Jinny You
dd121af20d lottie: correct the text alignment
When the Lottie Text Justify sets to center, text alignment should also be center.
2024-04-26 11:16:35 +09:00
JunsuChoi
535f2165a0 loader/svg: Check current graphics node that not closed
If any of the graphics nodes are not closed,
the graphics nodes between them are ignored.

related issue: https://github.com/thorvg/thorvg/issues/2210
2024-04-26 11:16:29 +09:00
JunsuChoi
7be6fe0c8e loader/svg: If link string is empty, not create picture object
An empty link causes the wrong loader to be found and causes various problems.

related issue : https://github.com/thorvg/thorvg/issues/2078#issuecomment-2067726046
2024-04-26 11:16:16 +09:00
Mira Grudzinska
5ba9f17a97 common: fix composition while masking
Using a mask (any type) with alpha set to less
than 255 through the fill(r, g, b, a) API resulted
in incorrect compositions of fill and stroke.
Incorrect results were also observed for luma masks,
as their alpha is calculated based on the other color
channels.

@issue: https://github.com/thorvg/thorvg/issues/1653
2024-04-26 11:16:10 +09:00
Mira Grudzinska
18a0c5e16e svg_loader: fix opacity cloning
The opacity value should be copied along
with other node properties.
2024-04-26 11:15:56 +09:00
Jinny You
243ff7b378 web: memory stability++
Call the explicit memory deletion—binded in function `delete()`, which is highly recommended by the Memory management in Emscripten guideline.

The function will guarantee that the WASM module is cleaned up from the memory.

see: https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management

Additionally, WASM module's initialization part has been refactored to correspond to the change.
2024-04-26 11:15:39 +09:00
Mira Grudzinska
1b391180c7 svg_loader: copy display property
The display property was not copied along with other
node properties. This caused incorrect rendering
of an object with display=none if accessed through
a use tag.
2024-04-26 11:15:02 +09:00
Mira Grudzinska
abb10afc88 svg_loader: correct polygon's points loading
Only an even number of correctly read points defining
a polygon should be loaded and passed on for rendering.
Any remaining points should be ignored.
2024-04-26 11:14:55 +09:00
Hermet Park
f8fa48d798 bump up version v0.13.1 2024-04-19 11:00:29 +09:00
Mira Grudzinska
f87601db58 sw_engine: fix max length of trimmed strokes
The error was visible when multiple shapes were
simultaneously trimmed. The length of a single
shape was zeroed out only in selected cases,
which caused accumulation that could lead to
incorrect extension of the variable determining
the maximum length.

@issue: https://github.com/thorvg/thorvg/issues/2173
2024-04-19 11:00:29 +09:00
JunsuChoi
86c4b093b7 loader/svg: Add check to the limits of result of StrToFloat
The string passed to the svg parser is not guaranteed to always be a valid string.
Certain strings may have numbers that cannot be converted.
Therefore, make sure to check whether the converted value is in the appropriate range before returning.

related issue: https://github.com/thorvg/thorvg/issues/2078#issuecomment-2037495121
2024-04-19 11:00:29 +09:00
Hermet Park
a6eddcbfab lottie: code clean up 2024-04-19 11:00:29 +09:00
Mira Grudzinska
9fd34c8503 build: add missing ifdef
The thorvg_lottie.h file wasn’t accessible
if the lottie loader was not activated,
causing a compilation error.
2024-04-19 11:00:29 +09:00
Jinny You
bf89da204e lottie/loader: Fix crash when parsing error
When parsing error, lottie loader raises runtime crash.
Check whether the composition is nullptr.
2024-04-19 11:00:29 +09:00