Commit graph

2097 commits

Author SHA1 Message Date
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
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
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
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
JunsuChoi
dca857d129 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-06-24 12:23:57 +09:00
JunsuChoi
6f6f311bb7 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-06-24 12:23:51 +09:00
Mira Grudzinska
4d8ad56cc5 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-06-24 12:23:46 +09:00
RuiwenTang
56de3bb3ca gl_engine: fix gradient rendering error
* Fix error when handle GradientTransform calculation. And move the inv
calculation into gradient vertex shader.
* Fix cubic tessellation not close the last point
2024-06-24 12:23:38 +09:00
Mira Grudzinska
4a8148f147 svg_loader: fix opacity cloning
The opacity value should be copied along
with other node properties.
2024-06-24 12:23:29 +09:00
Mira Grudzinska
81228855f9 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-06-24 12:21:50 +09:00
Mira Grudzinska
4316dd2620 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-06-24 12:21:44 +09:00
Mira Grudzinska
c5266725d4 Revert "loader/svg: Skip to invalid polygon"
This reverts commit 75e587a9a9.
If incorrect data for the points in a polygon is provided,
the element should still be rendered, but only up to the point
where the error occurs—using an even number of the points that
have been successfully loaded.
2024-06-24 12:21:38 +09:00
Hermet Park
fa118aa590 infra: meson code clean up 2024-06-24 12:21:20 +09:00
Mira Grudzinska
cc92865634 build: enforcing saver/loader usage for given tool
Selecting a tool without choosing the required tools
resulted in a usage error. Now, the activation
of the appropriate saver/loader for a given tool
is enforced.
2024-06-24 12:21:10 +09:00
Sergii Liebodkin
642fd77a3a wg_engine: update mesh generations and render mechanics
[issues 1479: lottie](#1479)

- optimaze stroking algorithm by prevent vector normalizations
- using render meshes heaps to reduce webgpu instances re-creations
- using single instance of pilylines for standard operations such as trim and split
- "on-the-fly" strokes generations with dash pattern
- "on-the-fly" mesh objects generation in a process of path decoding
- merge strokes into single mesh by each shape
2024-06-24 12:21:10 +09:00
Sergii Liebodkin
f73f3c8b53 wg_engine: added preallocated index buffers for triangle fans
[issues 1479: lottie](#1479)
2024-06-24 12:21:10 +09:00
Sergii Liebodkin
cebf723076 wg_engine: added math and polyline structures for geometry generating optimizations
[issues 1479: lottie](#1479)
2024-06-24 12:21:10 +09:00
Mira Grudzinska
179e2eb218 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-06-24 12:18:32 +09:00
JunsuChoi
0ebddb4f8f 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-06-24 12:18:24 +09:00
Hermet Park
39e9d6b583 lottie: code clean up 2024-06-24 12:18:16 +09:00
Mira Grudzinska
548a201b93 build: add missing ifdef
The thorvg_lottie.h file wasn’t accessible
if the lottie loader was not activated,
causing a compilation error.
2024-06-24 12:18:10 +09:00
Jinny You
557de3eb40 lottie/loader: Fix crash when parsing error
When parsing error, lottie loader raises runtime crash.
Check whether the composition is nullptr.
2024-06-24 12:17:59 +09:00
JunsuChoi
c69049ad78 loader/svg: Return actual decoded size
Returns the actual length of the decoded array.

related issue: https://github.com/thorvg/thorvg/issues/2156
2024-06-24 12:17:51 +09:00
RuiwenTang
216d958e97 gl_engine: using depth buffer to support path clip
* Append depth buffer attachment in tvgGlRenderPass
* using depth test if Shape has path clip
2024-06-24 12:17:38 +09:00
Hermet Park
0c12e662e4 lottie: ++stability
ensure that the loading has been completed before overriding.
2024-06-24 12:12:56 +09:00
Jinny You
2a8b80f058 lottie/common: Fix typo in API documentation comment 2024-06-24 12:12:49 +09:00
JunsuChoi
db1107c41b loader/svg: Add null to the end of data
Because memcpy() is not guaranteed to copy null at the end of the data array,
it increase the size by 1 and add null
This prevents invalid access of string functions in parser.
2024-06-24 12:12:40 +09:00