Commit graph

2704 commits

Author SHA1 Message Date
RuiwenTang
bb7f23da78 gl_engine: fix rendering error caused by viewport and stencil state
Fix some error:
* glViewport not controlled by framebuffer, and need to set manually when
target framebuffer is changed.
* change even-odd stencil operation, so no need to do third draw call to
  clear stencil buffer
* fix the missing `GlCanvas::update` calls in Lottoe and LottieExtension
2024-04-29 17:14:31 +09:00
Sergii Liebodkin
a532ac3eb2 wg_engine: blending and composition optimization
[issues 1479: Masking, InvMasking, LumaMasking, InvLumaMasking](#1479)

Computes composition and blending using simgle pass istead of two full screen passes
2024-04-29 16:36:00 +09:00
Hermet Park
e9311aeda4
Update AUTHORS 2024-04-27 03:01:06 +09:00
Francisco Ramírez
51877b328a
docs: Add Conan Installation steps 2024-04-27 02:59:42 +09:00
Jinny You
e7d27f8930 lottie: correct the text alignment
When the Lottie Text Justify sets to center, text alignment should also be center.
2024-04-26 11:11:15 +09:00
JunsuChoi
0d20eb71eb loader/svg: Check current graphics node that not closed
If any of the graphics nodes are not closed,
the graphics nodes between them are ignored.

related issue: https://github.com/thorvg/thorvg/issues/2210
2024-04-25 16:23:07 +09:00
JunsuChoi
a1ffa039bb loader/svg: If link string is empty, not create picture object
An empty link causes the wrong loader to be found and causes various problems.

related issue : https://github.com/thorvg/thorvg/issues/2078#issuecomment-2067726046
2024-04-25 13:18:53 +09:00
Mira Grudzinska
9183f1c11e common: fix composition while masking
Using a mask (any type) with alpha set to less
than 255 through the fill(r, g, b, a) API resulted
in incorrect compositions of fill and stroke.
Incorrect results were also observed for luma masks,
as their alpha is calculated based on the other color
channels.

@issue: https://github.com/thorvg/thorvg/issues/1653
2024-04-25 10:55:35 +09:00
RuiwenTang
25d43ddacf gl_engine: fix gradient rendering error
* Fix error when handle GradientTransform calculation. And move the inv
calculation into gradient vertex shader.
* Fix cubic tessellation not close the last point
2024-04-25 10:54:53 +09:00
Mira Grudzinska
d55b8afd6a svg_loader: fix opacity cloning
The opacity value should be copied along
with other node properties.
2024-04-25 10:41:15 +09:00
Jinny You
edc63ce28e web/examples: added dynamic component creation case
This change would help on testing dynamic creation/deletion of component.
2024-04-23 12:22:02 +09:00
Jinny You
f960c04474 web: memory stability++
Call the explicit memory deletion—binded in function `delete()`, which is highly recommended by the Memory management in Emscripten guideline.

The function will guarantee that the WASM module is cleaned up from the memory.

see: https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management

Additionally, WASM module's initialization part has been refactored to correspond to the change.
2024-04-23 12:22:02 +09:00
Mira Grudzinska
08fe14280d svg_loader: copy display property
The display property was not copied along with other
node properties. This caused incorrect rendering
of an object with display=none if accessed through
a use tag.
2024-04-23 11:20:37 +09:00
Mira Grudzinska
8d81ad360f 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-04-22 11:12:15 +09:00
Mira Grudzinska
2cb89c71a1 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-04-22 11:12:15 +09:00
Hermet Park
c3a6523294 infra: ++gitignore 2024-04-22 11:10:44 +09:00
Hermet Park
5d22b6fb9e infra: enable ttf loader in default. 2024-04-22 11:10:44 +09:00
Hermet Park
3399b36679 infra: meson code clean up 2024-04-22 11:10:44 +09:00
Mira Grudzinska
568846491d 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-04-19 10:01:30 +09:00
Sergii Liebodkin
c778f451b1 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-04-18 18:54:02 +09:00
Sergii Liebodkin
398d181e3f wg_engine: added preallocated index buffers for triangle fans
[issues 1479: lottie](#1479)
2024-04-18 18:54:02 +09:00
Sergii Liebodkin
90ce9d81bc wg_engine: added math and polyline structures for geometry generating optimizations
[issues 1479: lottie](#1479)
2024-04-18 18:54:02 +09:00
Mira Grudzinska
3a03fd7080
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-04-17 11:25:27 +09:00
JunsuChoi
f61efc6d84 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-04-17 11:00:03 +09:00
Hermet Park
ab4cf28888 lottie: code clean up 2024-04-16 18:14:49 +02:00
Mira Grudzinska
51eec98aae build: add missing ifdef
The thorvg_lottie.h file wasn’t accessible
if the lottie loader was not activated,
causing a compilation error.
2024-04-17 00:00:32 +09:00
Jinny You
54eedd4bb6 lottie/loader: Fix crash when parsing error
When parsing error, lottie loader raises runtime crash.
Check whether the composition is nullptr.
2024-04-16 13:37:27 +02:00
JunsuChoi
1bbf9bbb7d loader/svg: Return actual decoded size
Returns the actual length of the decoded array.

related issue: https://github.com/thorvg/thorvg/issues/2156
2024-04-16 13:32:03 +02:00
RuiwenTang
da45fa6608 gl_engine: using depth buffer to support path clip
* Append depth buffer attachment in tvgGlRenderPass
* using depth test if Shape has path clip
2024-04-16 13:36:13 +09:00
Hermet Park
0268e9e3d1 lottie: ++stability
ensure that the loading has been completed before overriding.
2024-04-16 10:30:14 +09:00
Jinny You
3de7580d96 lottie/common: Fix typo in API documentation comment 2024-04-16 10:30:01 +09:00
JunsuChoi
66c43352ef 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-04-16 10:27:20 +09:00
Mira Grudzinska
6406a369a5 authors: updating email address 2024-04-15 21:57:11 +09:00
Hermet Park
c713a53f32 lottie: code refactoring.
make it neat and clean.
2024-04-15 21:22:22 +09:00
Hermet Park
be7437e0a3 common: code refactoring
introduced mathDeg2Rad() and mathRad2Deg() for a common implementation.
2024-04-15 20:35:33 +09:00
RuiwenTang
bb793a2762 gl_engine: fix some typo inside GlRenderer
* Fix a typo error when prepare blit task
* Prevent repeated texture generation during task preparation
2024-04-15 11:05:34 +03:00
Hermet Park
d6b923fe5c AUTHORS: updated
Since ThorVG has a contributor section on the main page,
there is no need to keep the redundant email list anymore.
2024-04-15 12:39:25 +09:00
RuiwenTang
d9d677acc6 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-04-15 00:44:53 +09:00
Hermet Park
4d8f617af6 lottie: code refactoring.
keep the coding style.
2024-04-15 00:23:37 +09:00
Hermet Park
fa4b2cb704 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-04-15 00:08:34 +09:00
Jinny You
cc53bce8ab test/lottie: Add the segment use case 2024-04-14 23:54:26 +09:00
Jinny You
2ea79746e3 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-04-14 23:54:26 +09:00
Lucas Niu
b7ebccdc41 Update AUTHORS 2024-04-14 23:54:26 +09:00
Lucas Niu
b7ced09fef examples/lottie: Add example for the Marker
Co-authored-by: Jinny You <jinny@lottiefiles.com>
2024-04-14 23:54:26 +09:00
Lucas Niu
3af9faf116 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-04-14 23:54:26 +09:00
b4a0933a10 sw_engine : type cast compile error 2024-04-14 10:22:19 +09:00
06b4b2c586 sw_engine: Implement AVX and NEON optimizations for RasterGrayscale 2024-04-13 14:47:40 +09:00
JunsuChoi
387d82a80e 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-04-11 10:55:34 +09:00
JunsuChoi
75e587a9a9 loader/svg: Skip to invalid polygon
If a Polygon's points array is odd, it is not a valid shape.
2024-04-11 10:55:20 +09:00
Hermet Park
d98cb1a84b 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-04-11 10:54:49 +09:00