Commit graph

2672 commits

Author SHA1 Message Date
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
0ae98e7f31 infra: ++gitignore 2024-06-24 12:21:32 +09:00
Hermet Park
d1020445e3 infra: enable ttf loader in default. 2024-06-24 12:21:26 +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
Mira Grudzinska
b6f60de64a authors: updating email address 2024-06-24 12:12:34 +09:00
Hermet Park
c7d51ad0bb lottie: code refactoring.
make it neat and clean.
2024-06-24 12:12:26 +09:00
Hermet Park
bfed28e86e common: code refactoring
introduced mathDeg2Rad() and mathRad2Deg() for a common implementation.
2024-06-24 12:12:19 +09:00
RuiwenTang
b7eb72a27d gl_engine: fix some typo inside GlRenderer
* Fix a typo error when prepare blit task
* Prevent repeated texture generation during task preparation
2024-06-24 12:12:10 +09:00
Hermet Park
6556cddabb AUTHORS: updated
Since ThorVG has a contributor section on the main page,
there is no need to keep the redundant email list anymore.
2024-06-24 12:10:38 +09:00
RuiwenTang
574783be16 gl_engine: using normal texture rendering in final color blit
Since blit msaa framebuffer to another msaa framebuffer may generate
GLError in some platforms. Use normal texture rendering to blit the final
color buffer onto target framebuffer.
2024-06-24 12:10:18 +09:00
Hermet Park
026d85f6a8 lottie: code refactoring.
keep the coding style.
2024-06-24 12:05:59 +09:00
Hermet Park
0b5152f138 infra: revise the vector build script
Note that this change renames the Meson option from 'vector' to 'simd',
separates the NEON types into 'neon-arm' and 'neon-aarch',
and designates the 'mfpu' option solely for 'neon-arm'.
2024-06-24 12:05:47 +09:00
Jinny You
22513b2fea test/lottie: Add the segment use case 2024-06-24 12:05:34 +09:00
Jinny You
e9bd05bad5 bindings/capi: Support lottie segment and marker
new experimental apis for animation segment and lottie marker.

APIs:
- TVG_API Tvg_Result tvg_animation_set_segment(Tvg_Animation* animation, float begin, float end)
- TVG_API Tvg_Result tvg_animation_get_segment(Tvg_Animation* animation, float* begin, float* end = nullptr)
- TVG_API Tvg_Result tvg_lottie_animation_set_marker(Tvg_Animation* animation, const char* marker)
- TVG_API Tvg_Result tvg_lottie_animation_get_marker_cnt(Tvg_Animation* animation, uint32_t* cnt)
- TVG_API Tvg_Result tvg_lottie_animation_get_marker(Tvg_Animation* animation, uint32_t idx, const char** name)
2024-06-24 12:03:24 +09:00
Lucas Niu
fa60830e08 Update AUTHORS 2024-06-24 12:03:16 +09:00
Lucas Niu
e6e7ca9fee examples/lottie: Add example for the Marker
Co-authored-by: Jinny You <jinny@lottiefiles.com>
2024-06-24 12:02:53 +09:00
Lucas Niu
194bd8f01d lottie: Support the Animation Segment(Marker)
A single animation might have a desinated markers with naming: 0 ~ 0.5 (sector A), 0.5 ~ 1.0  (sector B). Selecting one of them using a marker name(sector A) and could play only that part with animation controllers.

usage:
- `animation->segment("sectionA") // Named segment(Marker)`
- `auto cnt = animation->markerCnt()`
- `auto name = animation->markers(index)`
- `animation->segment(0, 0.5) // Segment`
- `animation->segment(&begin, &end)`

Co-authored-by: Jinny You <jinny@lottiefiles.com>
2024-06-24 12:00:25 +09:00
9904d7b468 sw_engine : type cast compile error 2024-06-24 12:00:17 +09:00
6b27226390 sw_engine: Implement AVX and NEON optimizations for RasterGrayscale 2024-06-24 12:00:04 +09:00
JunsuChoi
6a03c4c2c1 loader/svg: Ignore unrecognized commands following 'z'
If the command after `m` is not recognized, it must be recognized as `l` or `L`.
However, if it is not recognized after ending with `z`, all commands after it are ignored.

```
<svg width="100" version="1.0" xmlns="http://www.w3.org/2000/svg" height="100" xmlns:xlink="http://www.w3.org/1999/xlink">

<path style="stroke:#F00" d="m 20,20 0,50 50 0 -50 -50 z  70,70 0,50 50 0 -50 -50 z  "/>

</svg>
```
2024-06-24 11:59:55 +09:00
JunsuChoi
43b5d0e462 loader/svg: Skip to invalid polygon
If a Polygon's points array is odd, it is not a valid shape.
2024-06-24 11:59:32 +09:00
Hermet Park
f108fc9363 lottie: corrected the comp/layer size data type.
Actually, the these size is expected to be a floating-point value.
This correction addresses a parsing error.

issue: https://github.com/thorvg/thorvg/issues/2153
2024-06-24 11:59:16 +09:00
Hermet Park
316317e0f7 Update README.md 2024-06-24 11:59:05 +09:00
Hermet Park
ca7aec5fff lottie: rectify the frame updates.
Currently, tvg ignores the frame value if the difference
is less than 0.001. In most cases, updating the frames
when the change is less than 1ms is just an unnecessary
burden on the system.

Instead, this ensures that the perfect last frame is reached.

issue: https://github.com/thorvg/thorvg/issues/2147
2024-06-24 11:58:48 +09:00
Rafał Mikrut
1c74e1e40a Finding crashes and adding comments 2024-06-24 11:57:28 +09:00
Hermet Park
2ff4e29949 bump up version 0.13.0 2024-04-07 15:15:59 +09:00
Hermet Park
f5cd67b77e tvg: updated binary resources to v0.13 2024-04-07 15:15:59 +09:00
Hermet Park
37b431c02f svg: code refactoring
-- compiler warnings on msvc
2024-04-07 15:15:59 +09:00
Hermet Park
9374437115 example: fixed broken tvg saver resource pathes 2024-04-07 15:15:59 +09:00
EunSik Jeong
6d3ea78d96 sw_engine/neon : Fix compilation error 2024-04-07 15:15:59 +09:00
Hermet Park
5431fdb77b docs: updated for 0.13 release 2024-04-07 15:15:59 +09:00
Hermet Park
710d1f99ae renderer/loader: fix a font loader memory leak 2024-04-07 15:15:59 +09:00
Hermet Park
f578a8947f test: improve the test-coverage.
make the lottie/text coverage up.

issue: https://github.com/thorvg/thorvg/issues/2067
2024-04-07 15:15:59 +09:00
Sergii Liebodkin
366c1be6bd wg_engine: vertex, index and unifroms buffers, render objects caching
[issues 1479: lottie](#1479)

Vertex, Index and uniform buffers now updates instead of recreate.
Implemented pools form mesh objects and render shapes data

it increase performance in 30-40% in massive animations scenes
2024-04-07 15:15:59 +09:00
Hermet Park
4746b2cf7b gl_engine: hotfix for the main surface drawing issue.
GL might need to generate a default target FBO
when the given target ID indicates the main surface.

However, users may want to draw visuals directly onto the main surface.

This policy must be reviewed thoroughly.
2024-04-07 15:15:59 +09:00