Commit graph

2719 commits

Author SHA1 Message Date
Mira Grudzinska
1c66b5fa3d svg_loader: fix data parsing
Added an additional XML entity to be
omitted while parsing.

@Issue: https://github.com/thorvg/thorvg/issues/2273
2024-05-24 11:17:37 +09:00
Jinny You
9c5eafd74e web: Reduce initial playing resources
Previously, the Intersection Observer doesn't filter hidden animations when page just loaded.

Ensure that the only visible animations to be played. Hidden resources will be frozen in the initial load.
2024-05-24 11:17:37 +09:00
Hermet Park
7e721e8ba7 web: Improve the performance.
Compared the FPS with ThorVG viewer at 1664x1664 resolution.
This minor tweak improves the performance by 2 to 5 FPS.
2024-05-24 11:17:37 +09:00
Hermet Park
24cdbc7369 wasm: code clean up
binary reduction by -188
2024-05-24 11:17:37 +09:00
Mira Grudzinska
3994ff0b01 lottie: matrix multiplication fix
In case the shapes could be merged, matrix
multiplication was not stored in any variable,
resulting in one of the transformations not
being applied.
2024-05-24 11:17:37 +09:00
Hermet Park
c4c6f177b3 renderer/canvas: tweak the viewport behavior.
reset the viewport context when target buffer is reset.
2024-05-24 11:17:37 +09:00
Hermet Park
89c86f6ad4 lottie: code clean up
- remove an unused return value.
- move bodies from header to implementation file.
- no logical changes.
2024-05-24 11:17:37 +09:00
Hermet Park
d8d717ec3f capi: support canvas viewport api
New Experimental API:
- Tvg_Result tvg_canvas_set_viewport(Tvg_Canvas* canvas, int32_t x, int32_t y, int32_t w, int32_t h);
2024-05-24 11:17:37 +09:00
Hermet Park
cc94060c6b xrenderer/engines: support the canvas viewport function.
The viewport function defines the rectangular area of the canvas
that will be used for drawing operations.

It is used to clip the rendering output to the boundaries of the rectangle.
Apps can use this function to set the drawing region within the canvas.

When the ThorVG canvas is partially inside the screen area such as during scrolling
it could help enhance rendering performance.

New Experimental API:
- Result Canvas::viewport(int32_t x, int32_t y, int32_t w, int32_t h) noexcept;

Issue: https://github.com/thorvg/thorvg/issues/2274
2024-05-24 11:17:37 +09:00
Hermet Park
a9b3ecf758 renderer/canvas: revise the logic.
introduce a status variable to identify
the condition precisely.
2024-05-24 11:17:34 +09:00
Hermet Park
19857966cb renderer/engines: added mainSurface() interface.
This interface expects the main surface of the raster engine.
2024-05-24 10:53:36 +09:00
Hermet Park
8403e2984b wg_engine: code refactoring
Use the override specifier so that
a compiler could warn any human mistake.
2024-05-24 10:53:28 +09:00
Mira Grudzinska
770ad3f179 lottie: fix build error without extras
After introducing roundness support, the build
process did not ensure proper compilation
for the case without expression support.
2024-05-21 16:31:48 +09:00
Hermet Park
6edac475f7 bump up version v0.13.4 2024-05-17 11:05:51 +09:00
Hermet Park
82bcdeba70 lottie: keep the code clean and neat.
- Separate the rounded corner logic from the updateStar
  since its logic has become too lengthy and complicated.
- Revise the path generation to eliminate duplicates.
2024-05-17 11:05:51 +09:00
Mira Grudzinska
dfe8570830 lottie: implement skew transformation
Added support for skew transformation by
a specified angle around a specified axis.
Applied to layers and shapes, not to repeaters.

@Issue: https://github.com/thorvg/thorvg/issues/2262
2024-05-17 11:05:51 +09:00
Mira Grudzinska
5183cf6737 lottie: fix access violation while updating
Fix access issue when iterating over children
in case of an empty container.

@Issue: https://github.com/thorvg/thorvg/issues/2283
2024-05-17 11:05:51 +09:00
Hermet Park
ebc37a0f12 lottie: fix compiler warnings. [-Wsign-compare] 2024-05-17 11:05:51 +09:00
Mira Grudzinska
08c8b92c4b lottie: handle roundness in path
Implemented rounding of corners between
bezier curves that are straight lines.

@Issue: https://github.com/thorvg/thorvg/issues/2230
2024-05-17 11:05:51 +09:00
Mira Grudzinska
1409b1356a lottie: support rounded stars
Implementation of the roundness property
for a polystar. Only the corners that were
not subject to rounding by the inner or
outer roundness parameters are affected.

@Issue: https://github.com/thorvg/thorvg/issues/2230
2024-05-17 11:05:51 +09:00
Hermet Park
6052407128 lottie: refactoring key frame logic.
compare floating-point values properly
to avoid potential precision loss.
2024-05-17 11:05:51 +09:00
Hermet Park
7b56240694 animation/lottie: improved the precision of frame values.
Refined the logic for updating frame numbers
to ensure greater accuracy in value precision.

issue: https://github.com/thorvg/thorvg/issues/2266
2024-05-17 11:01:35 +09:00
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