Commit graph

2980 commits

Author SHA1 Message Date
Hermet Park
a3fe9c25f2 wg_engine: code refactoring
Use the override specifier so that
a compiler could warn any human mistake.
2024-06-24 14:14:02 +09:00
Hermet Park
06553966e1 test/animation - added a frame counting test-suite. 2024-06-24 14:13:52 +09:00
Hermet Park
827a00b076 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-06-24 14:12:00 +09:00
Mira Grudzinska
b2be63a2d3 test: fix margin value
The precision margin for the comparison
has been set to 0.01f instead of 004004.
2024-06-24 14:11:54 +09:00
Jinny You
f00d3b5627 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-06-24 14:11:48 +09:00
Hermet Park
edbd2d7728 gl_engine: updated GLES minimum requirement from v2 to v3
GLES v3 was introduced many years ago;
we are now dropping support for GLES v2.

issue: https://github.com/thorvg/thorvg/issues/2269
2024-06-24 14:11:32 +09:00
Hermet Park
eeb06870a0 lottie: fixed a memory leak
Free the children data properly,
rarely observerd this, only when a layer is hidden.
2024-06-24 12:36:47 +09:00
Hermet Park
362faa3c9a 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-06-24 12:36:40 +09:00
Hermet Park
63705d9f04 examples/lottie: updated resources 2024-06-24 12:36:30 +09:00
Hermet Park
293d0ef037 lottie: code refactoring.
text tracking is an optional property.
it's good to initialize it with 0.
2024-06-24 12:36:23 +09:00
Jinny You
45b3583ad2 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-06-24 12:36:14 +09:00
JunsuChoi
6249263d2a example: Sync setting size and window default size
When WIDTH and HEIGHT values change,
the default size of the window also changes.
2024-06-24 12:36:04 +09:00
Hermet Park
13b46c41d2 common/array: ++safety
do not try memory copy if the size is 0.
2024-06-24 12:35:56 +09:00
Mira Grudzinska
dcf6ebcf18 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-06-24 12:35:42 +09:00
Hermet Park
c614efec3d lottie/expressions: fix a build break on windows. 2024-06-24 12:35:33 +09:00
Hermet Park
89d0f44eb9 lottie/expressions: fixed a memory access violation.
Reset memory after freeing the singletone instance.
2024-06-24 12:35:27 +09:00
Hermet Park
374e4ab82f test: corrected wrong implementation.
identifier should have been methods.
2024-06-24 12:35:17 +09:00
Hermet Park
364a51d0eb 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-06-24 12:35:11 +09:00
Mira Grudzinska
d27a9782d4 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-06-24 12:35:03 +09:00
Hermet Park
6503fcc8a8 infra: update the compiler options
- applying robust build options
- aligning options between gcc/clang compilers.
2024-06-24 12:34:57 +09:00
b224aa9765 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-06-24 12:34:49 +09:00
Mira Grudzinska
eedfc707f8 svg_loader: improved clarity, no logical changes
Unnecessary structure removed, typos corrected,
comment added, an unused function argument removed.
2024-06-24 12:34:42 +09:00
Mira Grudzinska
7779912219 svg_loader: paintOrder property properly copied
The paintOrder property set by the style was
not being copied. Now fixed.
2024-06-24 12:33:33 +09:00
b5b52d6d61 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-06-24 12:33:26 +09:00
Hermet Park
1fced1905d 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-06-24 12:33:19 +09:00
Hermet Park
6461929105 Update README.md 2024-06-24 12:33:12 +09:00
Hermet Park
7f1fbdcaa4 lottie/expressions: ++exceptional handling
Stop handling if the interpreting result is invalid.
2024-06-24 12:33:04 +09:00
Hermet Park
9cff11f25e lottie/expressions: apply expressions to missing properites. 2024-06-24 12:32:57 +09:00
Hermet Park
027e0fd6f0 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-06-24 12:32:14 +09:00
Hermet Park
fca4ef3109 lottie/expressions: ++exceptional handling.
Add an exceptional handling if interpreting code is failed.
2024-06-24 12:32:06 +09:00
Hermet Park
ac477d6896 lottie/expressions: make it up the insufficient content() behavior
this is a follow-up fix for the initial expressions feature.
2024-06-24 12:31:58 +09:00
Hermet Park
10c07476c6 lottie: fix a logic by a mistake. 2024-06-24 12:31:48 +09:00
RuiwenTang
06fc52ff22 gl_engine: fix stencil logical not correct
Fix the stencil reference and compile function cause rendering not
correct
2024-06-24 12:31:41 +09:00
RuiwenTang
3414a45039 gl_engine: optimize tessellation performance
* restrict the scissor box of composite task
* do not tessellate stroke or fill geometry if there is no Fill or
  Stroke color
* use actually transformed curve to calculate polyline count when doing
  curve flatten
2024-06-24 12:31:32 +09:00
Vincent Torri
e1f3ebd140 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-06-24 12:30:39 +09:00
Jinny You
911d14535d bindings/capi: Fix incompatible parameter
C API doesn't support default parameter, removed it.

Issue: #2228
2024-06-24 12:29:59 +09:00
Hermet Park
b615348df1 doc: adds the api version history 2024-06-24 12:29:36 +09:00
Hermet Park
d80b9969de lottie/jerryscript - size down the engine.
get rid of unused features in thorvg lottie.
2024-06-24 12:29:29 +09:00
Hermet Park
709ef9158f 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-06-24 12:29:17 +09:00
Hermet Park
a685ed5ce5 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-06-24 12:28:09 +09:00
Hermet Park
09a45b007e lottie: ++binary search stability.
this ensures that the return value is not below 0,
when the frame count is just 2.
2024-06-24 12:28:01 +09:00
Hermet Park
060f858568 lottie: specify the explicit parsing type.
these explicit type values are expected
to be referenced by the expressions.
2024-06-24 12:27:52 +09:00
Hermet Park
acd42f3bfa lottie: generalize parent context access in parsing.
ensure parent context is generally accessible,
not limited to gradients.
2024-06-24 12:27:45 +09:00
Hermet Park
b3d4b36710 examples/lottie: added expressions sample 2024-06-24 12:27:35 +09:00
Hermet Park
625a5ca747 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-06-24 12:27:26 +09:00
RuiwenTang
a6974a9495 gl_engine: fix rendering error caused by viewport and stencil state
Fix some error:
* glViewport not controlled by framebuffer, and need to set manually when
target framebuffer is changed.
* change even-odd stencil operation, so no need to do third draw call to
  clear stencil buffer
* fix the missing `GlCanvas::update` calls in Lottoe and LottieExtension
2024-06-24 12:27:17 +09:00
Sergii Liebodkin
ddc6fc7f0b wg_engine: blending and composition optimization
[issues 1479: Masking, InvMasking, LumaMasking, InvLumaMasking](#1479)

Computes composition and blending using simgle pass istead of two full screen passes
2024-06-24 12:24:53 +09:00
Hermet Park
b81557774f Update AUTHORS 2024-06-24 12:24:46 +09:00
Francisco Ramírez
b25b968316 docs: Add Conan Installation steps 2024-06-24 12:24:11 +09:00
Jinny You
7ecd90810d lottie: correct the text alignment
When the Lottie Text Justify sets to center, text alignment should also be center.
2024-06-24 12:24:04 +09:00