Commit graph

2980 commits

Author SHA1 Message Date
Mira Grudzinska
816e7cc584 examples: fix heap-use-after-free in Capi.cpp 2024-06-24 14:36:12 +09:00
Hermet Park
d8888923d1 lottie/builder: revise the layer build logic
Promote the text/image updates to the layer level.
2024-06-24 14:36:05 +09:00
Hermet Park
53f2a3f10b lottie: try packing data compactly. 2024-06-24 14:35:40 +09:00
Hermet Park
33883f302d lottie: optimize the internal data
encode the object name with the hash value
to save memory and enable fast data comparison.
2024-06-24 14:35:34 +09:00
Hermet Park
2cc522d9e9 lottie: code refactoring & size reduction
- introduced a pasing logic for duplicates.
- renamed internal varaible, no logical changes.
- removed null checks after memory alloc fails.
- reduced 1kb size.
2024-06-24 14:35:26 +09:00
Hermet Park
80bbf37c77 common/compressor: added djb2 encoder
This is useful for encoding the string into one long type value.
2024-06-24 14:35:20 +09:00
Hermet Park
37f38c788f lottie: hotfix memory leaks by a regression
A regression bug by a recent change:
1ee79a6c2a
2024-06-24 14:35:09 +09:00
Jinny You
c983a84be1 wasm: Support viewport API
wasm binding for viewport API in web.

see: #2276
2024-06-24 14:35:02 +09:00
Hermet Park
aacd8b73d1 infra: removed web support
Separated the web support into a new project repository.
https://github.com/thorvg/thorvg.web

This will help maintain the core logic more efficiently.

issue: https://github.com/thorvg/thorvg/issues/2297
2024-06-24 14:34:54 +09:00
Mira Grudzinska
0e59daafc7 lottie: repeater transformation fix
In the case of a transformation (denoted as T1)
appearing after the repeater, but at the same
level of nesting, the objects to which the repeater
is applied should not consider T1. However,
the transformation of the repeater itself should
take T1 into account.
Also, it is possible to have several consecutive
repeaters, and all of them should be taken into
account. Until now, the last one was overwriting
the previous one.
2024-06-24 14:34:42 +09:00
Mira Grudzinska
b812277a06 lottie: add 'tp' tag support
So far it hasn't been possible to specify
a matte layer - by default, it was the layer
above the calling layer. The 'tp' tag support
has been introduced, enabling referencing any
layer by its index.
In cases where the layer referencing the matte
was the first one, a segmentation fault was
observed. This issue has now been resolved.

@Issue: https://github.com/thorvg/thorvg/issues/2325
2024-06-24 14:34:34 +09:00
Mira Grudzinska
20d3992214 lottie: fix interpolation issue
Handled the case of different numbers
of points in consecutive frames. This
case can occur due to erroneous data
or as a consequence of changing the path
from closed to open and vice versa.

@Issue: https://github.com/thorvg/thorvg/issues/2287
2024-06-24 14:34:27 +09:00
RuiwenTang
25dbf4aacf gl_engine: Support StrokeCap in GlTessellator
Add new function `strokeSquare` and `strokeRound` to handle StrokeCap
during Path tessellation
2024-06-24 14:34:20 +09:00
RuiwenTang
e6deee7fd8 Fix AnimateMasking with GL backend not triger redraw 2024-06-24 14:34:11 +09:00
Niklas Fiekas
5204426667 sw_engine: fix -Wcalloc-transposed-args 2024-06-24 14:34:05 +09:00
Xu Xingliang
7437436fe9 capi: fix compile warning
Fix warning during build with lvgl https://github.com/lvgl/lvgl/pull/6081/

error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-06-24 14:33:57 +09:00
Hermet Park
407fcf69e3 common: code refactoring
Replace the math functions with operator overloading.
This should potentially reduce the code size.
2024-06-24 14:33:49 +09:00
Hermet Park
90397c79c9 Update AUTHORS 2024-06-24 14:32:14 +09:00
Hermet Park
3ea6264591 Update CODEOWNERS 2024-06-24 14:32:09 +09:00
Abdelrahman Ashraf
3a2183dfa7 fix: 🐛 missing binding for tvg_canvas_set_viewport c api 2024-06-24 14:32:03 +09:00
Hermet Park
f30b0fe04c examples: added more svg resources. 2024-06-24 14:31:28 +09:00
Hermet Park
c8adda4690 sw_engine: code clean up 2024-06-24 14:31:10 +09:00
Hermet Park
0e6fa01ac9 math: introduced a custom floating epsilon
Rather than aiming for extremely high accuracy,
a compromise can achieve with better performance.

This modification helps prevent unnecessary image rotation.

issue: https://github.com/thorvg/thorvg/issues/2265
2024-06-24 14:31:01 +09:00
Hermet Park
a71fd6652a lottie: fixed a missing slot overriding update.
the Lottie scene should be updated when the slot overriding
is updated. Previously, it only depended on the frame update.

issue: https://github.com/thorvg/thorvg/issues/2303
2024-06-24 14:30:46 +09:00
Sergii Liebodkin
9c8b10603e wg_engine: Fill Rule winding optimization
[issues 1479: Fill Rule](#1479)

In this solution we dont need to find silhouette, that is not a cheep operation (decreasing performance in 2 times)

For winding, you can select separate operations for front and back faces (increment for front, decrement for back)
After rendering the fan, the value in the stencil buffer will be the winding number. You can fill the appropriate portion by rendering a screen-sized quad with stencil testing enabled and the stencil function set according to which winding rule you wish to use.

For even-odd, you don't need to distinguish front and back faces; you can just use INVERT as the operation.
2024-06-24 14:30:39 +09:00
Hermet Park
a66f3a1a65 Update README.md 2024-06-24 14:30:32 +09:00
Mira Grudzinska
2c162174a8 svg_loader: fix data parsing
Added an additional XML entity to be
omitted while parsing.

@Issue: https://github.com/thorvg/thorvg/issues/2273
2024-06-24 14:30:26 +09:00
Jinny You
c555c41fd9 web: Reduce initial playing resources
Previously, the Intersection Observer doesn't filter hidden animations when page just loaded.

Ensure that the only visible animations to be played. Hidden resources will be frozen in the initial load.
2024-06-24 14:30:15 +09:00
Hermet Park
fbfd606840 web: Improve the performance.
Compared the FPS with ThorVG viewer at 1664x1664 resolution.
This minor tweak improves the performance by 2 to 5 FPS.
2024-06-24 14:30:07 +09:00
Hermet Park
87c7902411 wasm: code clean up
binary reduction by -188
2024-06-24 14:29:58 +09:00
Mira Grudzinska
fda8fe40ba lottie: matrix multiplication fix
In case the shapes could be merged, matrix
multiplication was not stored in any variable,
resulting in one of the transformations not
being applied.
2024-06-24 14:29:51 +09:00
Hermet Park
a93c348207 renderer/canvas: tweak the viewport behavior.
reset the viewport context when target buffer is reset.
2024-06-24 14:29:42 +09:00
Hermet Park
5c48127012 lottie: code clean up
- remove an unused return value.
- move bodies from header to implementation file.
- no logical changes.
2024-06-24 14:29:29 +09:00
Hermet Park
746c466df3 test: added viewport test 2024-06-24 14:29:19 +09:00
Hermet Park
e17fdbe3c6 test: clean up test suites
Merge two separate units: SwCanvas and SwCanvasBase.
2024-06-24 14:28:20 +09:00
Hermet Park
22cb25b488 examples: added a viewport sample 2024-06-24 14:21:55 +09:00
Hermet Park
c9d2fee233 capi: support canvas viewport api
New Experimental API:
- Tvg_Result tvg_canvas_set_viewport(Tvg_Canvas* canvas, int32_t x, int32_t y, int32_t w, int32_t h);
2024-06-24 14:21:03 +09:00
Hermet Park
090ebfba86 xrenderer/engines: support the canvas viewport function.
The viewport function defines the rectangular area of the canvas
that will be used for drawing operations.

It is used to clip the rendering output to the boundaries of the rectangle.
Apps can use this function to set the drawing region within the canvas.

When the ThorVG canvas is partially inside the screen area such as during scrolling
it could help enhance rendering performance.

New Experimental API:
- Result Canvas::viewport(int32_t x, int32_t y, int32_t w, int32_t h) noexcept;

Issue: https://github.com/thorvg/thorvg/issues/2274
2024-06-24 14:20:46 +09:00
Hermet Park
3433a50b4a renderer/canvas: revise the logic.
introduce a status variable to identify
the condition precisely.
2024-06-24 14:20:21 +09:00
Hermet Park
5b3a045f15 renderer/engines: added mainSurface() interface.
This interface expects the main surface of the raster engine.
2024-06-24 14:19:43 +09:00
Sergii Liebodkin
09751f63cd wg_engine: Text support
[issues 1479: Text](#1479)

EvenOdd fill rule reorganized: using global bbox of whole path for fill
2024-06-24 14:19:34 +09:00
Mira Grudzinska
3691ada265 lottie: fix build error without extras
After introducing roundness support, the build
process did not ensure proper compilation
for the case without expression support.
2024-06-24 14:19:28 +09:00
Hermet Park
bcc8dd4f09 lottie: keep the code clean and neat.
- Separate the rounded corner logic from the updateStar
  since its logic has become too lengthy and complicated.
- Revise the path generation to eliminate duplicates.
2024-06-24 14:19:19 +09:00
Mira Grudzinska
47e1d48b28 lottie: implement skew transformation
Added support for skew transformation by
a specified angle around a specified axis.
Applied to layers and shapes, not to repeaters.

@Issue: https://github.com/thorvg/thorvg/issues/2262
2024-06-24 14:19:11 +09:00
Jinny You
f000d9f766 test/lottie: added the slot resetting in animated property case 2024-06-24 14:18:59 +09:00
Mira Grudzinska
4daaa16384 lottie: fix access violation while updating
Fix access issue when iterating over children
in case of an empty container.

@Issue: https://github.com/thorvg/thorvg/issues/2283
2024-06-24 14:17:21 +09:00
Hermet Park
9ad992a958 lottie: fix compiler warnings. [-Wsign-compare] 2024-06-24 14:17:14 +09:00
Mira Grudzinska
6dc8a3b093 lottie: handle roundness in path
Implemented rounding of corners between
bezier curves that are straight lines.

@Issue: https://github.com/thorvg/thorvg/issues/2230
2024-06-24 14:16:45 +09:00
Mira Grudzinska
0fb37ea195 lottie: support rounded stars
Implementation of the roundness property
for a polystar. Only the corners that were
not subject to rounding by the inner or
outer roundness parameters are affected.

@Issue: https://github.com/thorvg/thorvg/issues/2230
2024-06-24 14:14:16 +09:00
Hermet Park
9ca8eacd65 infra/gl_enigne: fallback use gles v2 if the system doesn't have v3.
let's keep this for a while until our minimum requirement is clear.
2024-06-24 14:14:08 +09:00