Commit graph

2402 commits

Author SHA1 Message Date
Mira Grudzinska
b71b329a01 sw_engine: increased accuracy in dashing
The limit on leftovers was too small, which became
noticeable for animations with trimming - currently
implemented with the dashing alg.
The limit has been increased.
2024-09-01 01:29:05 +09:00
Hermet Park
38697022f0 sw_engine: fixed incorrect image blending operations
The anti-aliased outline color was incorrectly blended
at the multiply option.

The fix can be observed in the example:
'examples/lottie/resourcesguitar.json'

in order to do this, RenderMehthod::blend() method introduced
`bool direct` for figuring out the intermediate composition.
2024-08-30 00:53:44 +09:00
Mira Grudzinska
078b1c8d86 common: uint8_t version of the lerp
An uint8_t version of the lerp function
is introduced to handle cases where
the interpolation factor t exceeds 1, which
previously caused overflow issues due to casting.
2024-08-29 23:56:45 +09:00
Hermet Park
6b0c81bf36 lottie/expressions: rectified $bm_sum()
Added only a single element to x.
2024-08-29 21:16:58 +09:00
Hermet Park
b36db92a7b lottie/expressions: hotfix a crash
Stabilized $bm_sum(), by allowing the different dimensional
arguments.

issue: https://github.com/thorvg/thorvg/issues/2664
2024-08-29 19:41:37 +09:00
JunsuChoi
dd223b4065 svg_loader: Adjust hsl values out of range
The range of saturation and brightness values is 0 ~ 100% and range of hue is 0 ~ 360.
If a value greater than 100% is loaded, it will be modified to be 100%.

issue: https://github.com/thorvg/thorvg/issues/2678
2024-08-29 12:05:47 +02:00
Mira Grudzinska
bb3c6516e5 lottie: fix trim
The bug caused the trim path to not be applied
when it appeared in a group between different
shapes.
2024-08-29 17:30:41 +09:00
Mira Grudzinska
76c1b20dee lottie: fix trim path regression
To avoid editing the trim path values provided
by the user, the logic for their interpretation
was moved from the API to the renderer (7c87d8e).
This caused an issue in the lottie animations when
the trim path is applied more than once. Now fixed.

@issue: https://github.com/thorvg/thorvg/issues/2670
2024-08-28 23:03:44 +09:00
Łukasz Pomietło
c92cf4e139 renderer/text: fix a missing text update
previously font size & italic style had been ignored
even if its attributes are changed.

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>

issue: https://github.com/thorvg/thorvg/issues/2676
2024-08-28 21:30:16 +09:00
Sergii Liebodkin
732a2be7e8 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-08-28 18:33:07 +09:00
Jinny You
747967638d wasm: fix typo 2024-08-27 17:33:56 +09:00
Hermet Park
45358a70ca lottie/parser: enable logs to notify missing features 2024-08-26 20:30:33 +09:00
Hermet Park
4fda695c3c 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-08-25 23:11:47 +09:00
lpogic
df8c79fbc1 text: fixed a corrupted italic style application
issue: https://github.com/thorvg/thorvg/issues/2669
2024-08-24 21:45:13 +09:00
tangruiwen.mmh1103
5f5060dbf2 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-08-24 13:57:48 +09:00
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
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
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
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
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