Commit graph

3296 commits

Author SHA1 Message Date
Hermet Park
df2d3a95f8 lottie/jerryscript: ++build reliance 2024-08-23 15:08:55 +09:00
Hermet Park
11b756791b common/math: remove inlining
Let the compiler decide whether to inline.
2024-08-23 14:41:02 +09:00
Mira Grudzinska
87d85047aa 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-08-23 01:18:50 +09:00
Mira Grudzinska
e4ec2a8a0e lottie: roundness refactored based on #2295 2024-08-23 01:18:50 +09:00
Mira Grudzinska
6bb95883e5 common: prevent warning - expression result unused 2024-08-22 22:54:00 +09:00
Hermet Park
82c1e68b16 renderer/text: --memory leak
regression by 71d3fce1dd
2024-08-22 22:39:35 +09:00
Hermet Park
00127cba54 sw_engine/texmap: ++fixed memory access violation
Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>
2024-08-22 22:39:35 +09:00
Mira Grudzinska
09313ae307 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-08-22 21:27:25 +09:00
Hermet Park
ac384332fe examples: added image rotation 2024-08-22 13:01:53 +09:00
Mira Grudzinska
ed38e1e0e0 sw_engine: fix TexmapPolygon rastering
The y range initialization was missing a check to ensure
that the height is a positive value. This could lead to
an attempt to call malloc with a negative argument, which
cast to an unsigned value, caused a crash.
2024-08-21 18:46:02 +09:00
Jinny You
58db802ac1 wasm: code refactoring
Introduced the abstract EngineMethod to handle
different engines more effectively using polymorphism.

Co-authored-by: Jinny You <jinny@lottiefiles.com>
2024-08-21 17:17:50 +09:00
Hermet Park
71d3fce1dd renderer: text refactoring
- assign the shape instance as mandatory.
- assign the text instance internally.
2024-08-21 14:51:53 +09:00
Hermet Park
c75311d239 api: corrected wrong const specifier
Setter obvisouly modifies the instance.
2024-08-21 14:50:40 +09:00
Mira Grudzinska
022f9fc897 examples: capi example ++
Animation is loaded from a memory instead from a file.
2024-08-20 18:46:29 +09:00
Mira Grudzinska
5448b1b9cd docs: description++ 2024-08-20 18:44:39 +09:00
Jinny You
d704a2503a 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-08-20 17:26:23 +09:00
Jinny You
32954f962d 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-08-20 17:26:23 +09:00
Sergii Liebodkin
0787e46635 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-08-20 16:23:31 +09:00
Hermet Park
8598348ec0 doc: ++enhancement in Picture::load()
addressed supported raw data format.

issue: https://github.com/thorvg/thorvg/issues/2648
2024-08-20 11:53:40 +09:00
Hermet Park
5332876fe8 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-08-20 11:14:54 +09:00
Hermet Park
53b9c2bf3a
Update README.md 2024-08-19 23:55:45 +09:00
Hermet Park
dfce7115d9
Update AUTHORS 2024-08-19 17:43:37 +09:00
Elliott Sales de Andrade
5f08b9ade4 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-08-19 17:42:40 +09:00
Elliott Sales de Andrade
966aeb5ee3 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-08-19 17:42:06 +09:00
Hermet Park
9c36b78140 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-08-17 13:37:10 +09:00
Mira Grudzinska
f79558eb62 API: deprecate the appendArc() api
@Issue: https://github.com/thorvg/thorvg/issues/2632
2024-08-16 13:30:58 +09:00
Mira Grudzinska
7c13da461a lottie: prioritization of roundness in rectangles
Added prioritization of rectangle roundness over
rounded corners, in line with AE results.
2024-08-14 11:16:54 +09:00
Sergii Liebodkin
88b4f75e4f 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-08-13 11:52:45 +03:00
Hermet Park
407fc84796 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-08-13 10:21:54 +09:00
Mira Grudzinska
e50bf002de 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-08-12 18:52:14 +09:00
Hermet Park
5ae556cf13 wasm: thorvg canvas resize problem.
The canvas syncs before changing a target buffer.

issue: https://github.com/thorvg/thorvg/issues/2580
2024-08-12 18:35:31 +09:00
Hermet Park
290b52198f lottie: code refactoring
getting too many parameters,
migrated static functions to class member functions,
reducing the binary size by 2KB

no logical changes
2024-08-12 17:41:51 +09:00
Hermet Park
7fb0762454 lottie: ++scene rendering optimization
Apply LottieRenderPooler to RenderContext propagators.
2024-08-12 13:55:31 +09:00
Hermet Park
62f88ec072 lottie: ++scene rendering optimization
Apply LottieRenderPooler to maskings.
2024-08-12 13:55:31 +09:00
Mira Grudzinska
75ed0e4e09 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-08-10 13:40:44 +09:00
Sergii Liebodkin
132b22cb47 webgpu: light/dark mask mode support
[issues 2608: light/dark mask](#2608)

* CompositeMethod::LightMask
* CompositeMethod::DarkMask
2024-08-10 13:19:30 +09:00
Sergii Liebodkin
a4bbf14371 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-08-09 14:30:17 +09:00
Mira Grudzinska
eca0011846 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-08-08 19:52:46 +09:00
Mira Grudzinska
4b73a074c4 common: add missing consts
Adding const was necessary to allow calling
the functions on constant objects.
2024-08-08 19:52:46 +09:00
Mira Grudzinska
efcaa807ab 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-08-08 19:52:35 +09:00
Hermet Park
5ebe33af90 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-08-08 14:47:01 +09:00
Hermet Park
d7c4cda352 renderer: rectified the bounds() behavior
Text fill is broken by 43c87b4eb5
2024-08-08 14:30:12 +09:00
Hermet Park
3e78a95b57 lottie: support matte+masking combination
introduced an intermediate scene for embracing
the matte and maskings
2024-08-08 13:55:16 +09:00
Hermet Park
69dccc326a lottie/expressions: rectified fill color support
Assign the fill color value properly.
2024-08-07 19:27:34 +09:00
Hermet Park
de9da0b93a lottie: code refactoring
Moved common data declarations to tvgLottieCommon.h.
2024-08-07 19:27:34 +09:00
Hermet Park
f7221f7f89 lottie/expressions: revised exception handlings 2024-08-07 14:59:09 +09:00
Hermet Park
33d7425294 lottie/model: implement the missing property() interface 2024-08-07 14:59:04 +09:00
Hermet Park
19b21852e3 test: coverage enhancement
+ Accessor::id()
+ Picture::paint()
2024-08-07 12:02:22 +09:00
Hermet Park
92303e91b4 examples: added Interaction sample
The Interaction sample demonstrates
how to handle user input with ThorVG Animation.
2024-08-07 12:02:22 +09:00
Hermet Park
43c87b4eb5 renderer/paint: revise the Paint::bounds() behavior
The current Paint::bounds(transform=true) returns the coordinates
of the paint in its local coordinates after transformation.

However, it did not convert the origin to the world coordinate.

This is problematic when the user wants to determine
the paint's position and size with the origin being the canvas.
Specifically, this matters that when the paint is belonged
to a certain scene.

Now, the bounds() method returns the coordinates
of the paint's bounding box with the corrected world space.
User can figure out the actual boundary within the painted result.

Remark that, this may break the functional behavior compatibility.
2024-08-07 12:02:22 +09:00