Commit graph

3281 commits

Author SHA1 Message Date
Sergii Liebodkin
adbb6be504 wg_engine: scene blending optimization
- used hardware blending stage for scene blending
- used AABB for scene blending
- reduced number of offfscreen buffers coping
- reduced number of render pass switching
- used render pipelines abilities to convert offscreen pixel format to screen pixel format
- removed unused shaders
2024-09-30 16:44:22 +09:00
Jinny You
52c44287c6 wasm: fix typo 2024-09-30 16:44:22 +09:00
Hermet Park
89031244cd lottie/parser: enable logs to notify missing features 2024-09-30 16:44:21 +09:00
Hermet Park
446d93805e lottie/expressions: Improve safety
- Prevent expression processing if a property fails to parse.
- Fixed an incorrect usage of JerryScript.

This is a hotfix to address expression-related crashes.
2024-09-30 16:44:21 +09:00
lpogic
9ed393aa26 text: fixed a corrupted italic style application
issue: https://github.com/thorvg/thorvg/issues/2669
2024-09-30 16:44:21 +09:00
tangruiwen.mmh1103
a9d314985c gl_engine: fix mistake in the calculation of stroke miter limit
* correct the stroke width and color calculation with scaling
* fix the miter limit calculation to make bevel join fallback correct
2024-09-30 16:44:21 +09:00
Hermet Park
34d0309fcc lottie/jerryscript: ++build reliance 2024-09-30 16:44:21 +09:00
Hermet Park
9c9f4f9d3c common/math: remove inlining
Let the compiler decide whether to inline.
2024-09-30 16:44:21 +09:00
Mira Grudzinska
90e7a50c8e lottie: add offsetPath support
Due to the lack of an analytical solution for Bezier
curves offsetting, a simple and computationally cheap
approximation has been implemented. The algorithm shifts
the segments connecting control points and determines
new points based on their intersections.

@issue: https://github.com/thorvg/thorvg/issues/2230
2024-09-30 16:44:21 +09:00
Mira Grudzinska
448d84ffb7 lottie: roundness refactored based on #2295 2024-09-30 16:44:21 +09:00
Mira Grudzinska
a7eae339a5 common: prevent warning - expression result unused 2024-09-30 16:44:21 +09:00
Hermet Park
1fc595aa5e renderer/text: --memory leak
regression by 71d3fce1dd
2024-09-30 16:44:21 +09:00
Hermet Park
aad400a869 sw_engine/texmap: ++fixed memory access violation
Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>
2024-09-30 16:44:21 +09:00
Mira Grudzinska
b8e4abd243 lottie: fix text update
The occurrence of a 'carriage return' (13) or 'end of text' (3)
caused the skipping of the next character check, immediately
searching for it in the list of available characters.
If the next character was also 13 or 3, it led to incorrect
interpretation; however, if it was the last character in the
sequence, a crash occurred.
2024-09-30 16:44:21 +09:00
Hermet Park
62416132ca examples: added image rotation 2024-09-30 16:44:21 +09:00
Jinny You
9ebd9ef11b wasm: code refactoring
Introduced the abstract EngineMethod to handle
different engines more effectively using polymorphism.

Co-authored-by: Jinny You <jinny@lottiefiles.com>
2024-09-30 16:44:21 +09:00
Hermet Park
fac8ba3d9f renderer: text refactoring
- assign the shape instance as mandatory.
- assign the text instance internally.
2024-09-30 16:44:21 +09:00
Hermet Park
0a59e02a21 api: corrected wrong const specifier
Setter obvisouly modifies the instance.
2024-09-30 16:44:21 +09:00
Mira Grudzinska
e0203a2fa2 examples: capi example ++
Animation is loaded from a memory instead from a file.
2024-09-30 16:44:21 +09:00
Mira Grudzinska
a2d6af70f8 docs: description++ 2024-09-30 16:44:21 +09:00
Jinny You
a2af7aae2e bindings/wasm: Support WebGPU
Updated WASM binding to bring WebGPU on the web player.

binding will generate a WASM binary, which can render animation through both SW and WG raster engine.

A raster engine will be chosen by parameter `engine`, when initializing.
2024-09-30 16:44:21 +09:00
Jinny You
dca095b3c1 wasm/infra: Add build scripts for WebGPU
New build script for WASM with WebGPU.

Run `wasm_webgpu_build.sh` to have WebGPU WASM binary
2024-09-30 16:44:21 +09:00
Sergii Liebodkin
356cae5e8a wg_engine: aabb based masking optimization
* used fragment shaders for mask applience instead of compute shaders
* less render targets swithing
* shape aabb based on transformed shape bbox
2024-09-30 16:44:21 +09:00
Hermet Park
54ea89ef6b doc: ++enhancement in Picture::load()
addressed supported raw data format.

issue: https://github.com/thorvg/thorvg/issues/2648
2024-09-30 16:44:21 +09:00
Hermet Park
0f17f6c69a common: spec out TexMap
Spec out this incomplete experimental feature,
this is a still promising one, we will reintroduce
this officially after 1.0 release

size: -2kb

issue: https://github.com/thorvg/thorvg/issues/1372
2024-09-30 16:44:21 +09:00
Hermet Park
affe6718b5 Update README.md 2024-09-30 16:44:21 +09:00
Hermet Park
c9617a7185 Update AUTHORS 2024-09-30 16:44:21 +09:00
Elliott Sales de Andrade
ee19753f36 build: Remove redundant comparisons
If a Meson option is typed as `boolean`, the `get_option` returns a
boolean, and comparing it with `true` is redundant. Meson also errors if
you try to compare across types, so it couldn't _not_ be a boolean.

Also, Meson is not C, so no need for parentheses around `if` conditions.
2024-09-30 16:44:21 +09:00
Elliott Sales de Andrade
199dbac419 build: Override dependency for use as subproject
A pkgconfig file is already provided, which enables using `thorvg` once
it is installed. However, this file is not, and cannot be, available at
setup time if using `thorvg` as a subproject.

In such cases, Meson provides the `override_dependency` mechanism for a
subproject to tell its parent how to use it.
2024-09-30 16:44:21 +09:00
Hermet Park
738f8f745a lottie: ensure a null terminator at the end of the copied data
In certain cases, the user might want to set mapped memory directly.
This update ensures that a null terminator is appended to the string data.

Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>

Issue: https://github.com/thorvg/thorvg/issues/2642
2024-09-30 16:44:21 +09:00
Mira Grudzinska
2a342a5463 API: deprecate the appendArc() api
@Issue: https://github.com/thorvg/thorvg/issues/2632
2024-09-30 16:44:21 +09:00
Mira Grudzinska
0857f2b10d lottie: prioritization of roundness in rectangles
Added prioritization of rectangle roundness over
rounded corners, in line with AE results.
2024-09-30 16:44:21 +09:00
Sergii Liebodkin
9efab30b00 webgpu: shaders refactoring
Deep shader refactoring for the following purposes:
* used pre-calculated gradient texture instead of per-pixel gradient map computation
* used HW wrap samples for fill spread setting
* unified gradient shader types
* used single shader module for composition instead of signle module per composition type
* used single shader module for blending for each of fill type (solid, gradient, image) instaed of signle module per blend type
* much easier add new composition and blend equations
* get rided std::string uasge
* shaders code is more readable
2024-09-30 16:44:21 +09:00
Hermet Park
a25366b283 common: spec out Scene Clipper
Scene Clipper is an unusual feature
that is too unstable and ambiguous in ThorVG.

Users can achieve the same functionality
with multiple composed shapes instead of scene clipping.

size: -2.5kb

issues:
- https://github.com/thorvg/thorvg/issues/1548
- https://github.com/thorvg/thorvg/issues/1549
- https://github.com/thorvg/thorvg/issues/1573
2024-09-30 16:44:21 +09:00
Hermet Park
05d4d05f59 examples/text: hotfix
corrected wrong arguments.
2024-09-30 16:44:21 +09:00
Mira Grudzinska
2141f14e27 lottie: handle edge case for rounded rect
For rounded rectangles the roundness value should
be determined using to the formula:
r = min(r, max(size.x, size.y)/2)
rather than the previous method:
r = min(size.x/2, size.y/2, r)
2024-09-30 15:53:45 +09:00
Hermet Park
ec6e8a6e94 wasm: thorvg canvas resize problem.
The canvas syncs before changing a target buffer.

issue: https://github.com/thorvg/thorvg/issues/2580
2024-09-30 15:53:39 +09:00
Hermet Park
bc77c0ee74 lottie: code refactoring
getting too many parameters,
migrated static functions to class member functions,
reducing the binary size by 2KB

no logical changes
2024-09-30 15:53:18 +09:00
Hermet Park
dcf051346c lottie: ++scene rendering optimization
Apply LottieRenderPooler to RenderContext propagators.
2024-09-30 15:53:09 +09:00
Hermet Park
9f5a83f067 lottie: ++scene rendering optimization
Apply LottieRenderPooler to maskings.
2024-09-30 15:53:02 +09:00
Mira Grudzinska
49f586b3e7 lottie: handle rounded polygons
The implementation of rounded polygons was
mistakenly omitted, now has been added.

@Issue: https://github.com/thorvg/thorvg/issues/2624
2024-09-30 15:52:55 +09:00
Sergii Liebodkin
55d248a31d webgpu: light/dark mask mode support
[issues 2608: light/dark mask](#2608)

* CompositeMethod::LightMask
* CompositeMethod::DarkMask
2024-09-30 15:52:50 +09:00
Sergii Liebodkin
f281cc9e92 wg_engine: composition and blend optimization
* bind groups creation in real time removed - performance boost
* blend and composition shaders decomposed - performance boost
* shader modules and pipeline layouts generalized - less memory usage
* shared single stencil buffer used - less memory usage
* bind groups usage simplified
* general context API simplified and generalized
* all rendering logic moved into new composition class
* ready for hardware MSAA (in next steps)
* ready for direct mask applience (in next steps)
2024-09-30 15:52:44 +09:00
Mira Grudzinska
997093be96 common: fix arg name
For Bezier curves, we typically use 't' as a parameter
within the 0-1 range, while 'at' is used for the parameter
scaled by the curve's length. In one of the functions,
an incorrect name was used, which could be confusing.
No logical changes.
2024-09-30 15:52:37 +09:00
Mira Grudzinska
4227192193 common: add missing consts
Adding const was necessary to allow calling
the functions on constant objects.
2024-09-30 15:52:25 +09:00
Mira Grudzinska
e9fcd40099 common: increase precision for bezier calculations
The epsilon value currently used for the precision
of Beziers calculations is sufficient for comparing
curve lengths. However, for the parameter t, which
ranges from 0 to 1, an accuracy of 1% can introduce
errors.
The solution is to increase the precision for the t
parameter while keeping the rest of the calculations
at the previously used epsilon value.

@Issue: https://github.com/thorvg/thorvg/issues/2619
2024-09-30 15:52:20 +09:00
Hermet Park
6fd00329aa infra: switch the optimization option to level 3
In case of modern systems, size is not a big problem,
so we turn the optimization option to default
for better performance.

FPS: ~20% enhanced
Size: ~25% increased

Note that this doesn't affect to the web player.
2024-09-30 15:52:16 +09:00
Hermet Park
d732030bef renderer: rectified the bounds() behavior
Text fill is broken by 43c87b4eb5
2024-09-30 15:49:57 +09:00
Hermet Park
1317b1690f lottie: support matte+masking combination
introduced an intermediate scene for embracing
the matte and maskings
2024-09-30 15:49:52 +09:00
Hermet Park
e2b99ec308 lottie/expressions: rectified fill color support
Assign the fill color value properly.
2024-09-30 15:49:44 +09:00