Commit graph

3250 commits

Author SHA1 Message Date
Sergii Liebodkin
785a75a1ca wg_engine: external device handles (web integration)
move instance, adapter and device creation from renderer to application
its necessary for web integration, because browser have its own mechanics to create hardware handles
this changes makes webgpu canvas more universal to use in case of system and web applications

issue: https://github.com/thorvg/thorvg/issues/2410
2024-09-30 16:44:22 +09:00
Hermet Park
ca7f837e5c examples: ++svg samples 2024-09-30 16:44:22 +09:00
Mira Grudzinska
e271485607 svg_loader: fix text nodes issue
Since the text node wasn't pushed onto the loader's stack,
closing the text node incorrectly caused an element to be
popped from the stack (if one was present).
This could result in elements that were supposed to have
that element as a parent being rendered incorrectly or not
being rendered at all.
Now, the text node is correctly pushed onto the stack.

@Issue: https://github.com/thorvg/thorvg/issues/2706
2024-09-30 16:44:22 +09:00
Hermet Park
5d1e324aee common: remove redundant code 2024-09-30 16:44:22 +09:00
Hermet Park
6c6b29ad42 common/math: replace isinfinite() with isinf() 2024-09-30 16:44:22 +09:00
Mira Grudzinska
163f7d1716 common: precision increase while matrix inversion
A numerically motivated limit on the matrix determinant
set at 1e-6 was not sufficient. The limit has been increased
by checkoing whether 1/det is still a number.
2024-09-30 16:44:22 +09:00
Hermet Park
c4678eb420 lottie/parser: ++ null value handling
Note that, only dealt with a obivous case in practice.

issue: https://github.com/thorvg/thorvg/issues/2703
2024-09-30 16:44:22 +09:00
Łukasz Pomietło
3c5cf13eb5 loader/ttf: Spaces and invalid glyphs rendering fix
If for any reason an invalid glyph is found in text, 
it will now be skipped when rendering 
(instead of increasing offset by last valid glyph advance).

Issue: #2687
2024-09-30 16:44:22 +09:00
Mira Grudzinska
ec4b08245c lottie: handle trim path edge cases
According to the definition of trim path elements,
the begin and end values are specified as percentages
in the range of 0-100% (this is also confirmed by AE,
where it's not possible to exceed this range).
Added clamping to align with spec.
2024-09-30 16:44:22 +09:00
Mira Grudzinska
8b8a6ba3e7 common: introduce tvg::clamp 2024-09-30 16:44:22 +09:00
Mira Grudzinska
c9c8e35476 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-30 16:44:22 +09:00
Hermet Park
44ca306841 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-09-30 16:44:22 +09:00
Mira Grudzinska
1fc0546dea 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-09-30 16:44:22 +09:00
Hermet Park
82f2ce4bd4 lottie/expressions: rectified $bm_sum()
Added only a single element to x.
2024-09-30 16:44:22 +09:00
Hermet Park
b660a99bca lottie/expressions: hotfix a crash
Stabilized $bm_sum(), by allowing the different dimensional
arguments.

issue: https://github.com/thorvg/thorvg/issues/2664
2024-09-30 16:44:22 +09:00
JunsuChoi
faec19bff6 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-09-30 16:44:22 +09:00
Mira Grudzinska
d7405e7be8 lottie: fix trim
The bug caused the trim path to not be applied
when it appeared in a group between different
shapes.
2024-09-30 16:44:22 +09:00
Mira Grudzinska
362b51028d 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-09-30 16:44:22 +09:00
Łukasz Pomietło
cde6a24b1b 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-09-30 16:44:22 +09:00
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