Commit graph

2846 commits

Author SHA1 Message Date
Hermet Park
3cd30c3197 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-05-30 13:00:42 +09:00
Hermet Park
ee99fe3942 common/compressor: added djb2 encoder
This is useful for encoding the string into one long type value.
2024-05-30 13:00:42 +09:00
Hermet Park
7ce8db4d34 lottie: hotfix memory leaks by a regression
A regression bug by a recent change:
1ee79a6c2a
2024-05-30 12:52:39 +09:00
Jinny You
6870953713 wasm: Support viewport API
wasm binding for viewport API in web.

see: #2276
2024-05-30 10:56:18 +09:00
Hermet Park
b19ae5b8c0 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-05-30 10:56:01 +09:00
Mira Grudzinska
7b9bebe1de 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-05-29 23:43:01 +09:00
Mira Grudzinska
1ee79a6c2a 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-05-29 23:17:13 +09:00
Mira Grudzinska
3a8ef78a36 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-05-28 18:59:16 +09:00
RuiwenTang
03e7c70524 gl_engine: Support StrokeCap in GlTessellator
Add new function `strokeSquare` and `strokeRound` to handle StrokeCap
during Path tessellation
2024-05-27 23:14:21 +09:00
RuiwenTang
a50335686d Fix AnimateMasking with GL backend not triger redraw 2024-05-27 23:14:08 +09:00
Niklas Fiekas
cf5b08de8a sw_engine: fix -Wcalloc-transposed-args 2024-05-27 23:13:52 +09:00
Xu Xingliang
d113540d61 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-05-27 23:13:34 +09:00
Hermet Park
a1818cf62b common: code refactoring
Replace the math functions with operator overloading.
This should potentially reduce the code size.
2024-05-27 10:48:46 +09:00
Hermet Park
a95d5667eb
Update AUTHORS 2024-05-24 22:37:43 +09:00
Hermet Park
54a886f673 Update CODEOWNERS 2024-05-24 22:29:07 +09:00
Abdelrahman Ashraf
178cf2944d fix: 🐛 missing binding for tvg_canvas_set_viewport c api 2024-05-24 13:19:48 +02:00
Hermet Park
5c8b68c220 examples: added more svg resources. 2024-05-24 10:45:24 +09:00
Hermet Park
efe770c3af sw_engine: code clean up 2024-05-24 10:45:24 +09:00
Hermet Park
975907731d 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-05-24 10:45:24 +09:00
Hermet Park
2e50ee3c3d 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-05-24 10:34:58 +09:00
Sergii Liebodkin
cd6a77af96 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-05-23 14:37:56 +09:00
Hermet Park
1198d49ab1 Update README.md 2024-05-23 13:23:04 +09:00
Mira Grudzinska
7472a87268 svg_loader: fix data parsing
Added an additional XML entity to be
omitted while parsing.

@Issue: https://github.com/thorvg/thorvg/issues/2273
2024-05-23 10:50:54 +09:00
Jinny You
9c7a97787a 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-05-23 10:50:38 +09:00
Hermet Park
92e1dd6747 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-05-21 16:05:53 +09:00
Hermet Park
c9f05526a8 wasm: code clean up
binary reduction by -188
2024-05-21 16:05:53 +09:00
Mira Grudzinska
9a455632a2 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-05-20 22:03:07 +09:00
Hermet Park
c784ed7362 renderer/canvas: tweak the viewport behavior.
reset the viewport context when target buffer is reset.
2024-05-20 14:44:15 +09:00
Hermet Park
c261cc55ac lottie: code clean up
- remove an unused return value.
- move bodies from header to implementation file.
- no logical changes.
2024-05-20 11:47:26 +09:00
Hermet Park
a8de40818e test: added viewport test 2024-05-18 18:10:50 +09:00
Hermet Park
de75c58b89 test: clean up test suites
Merge two separate units: SwCanvas and SwCanvasBase.
2024-05-18 18:10:50 +09:00
Hermet Park
39fb3ed478 examples: added a viewport sample 2024-05-18 18:10:50 +09:00
Hermet Park
7ea17d4e72 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-05-18 18:10:50 +09:00
Hermet Park
42409987e2 renderer/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-05-18 18:10:50 +09:00
Hermet Park
70708211fe renderer/canvas: revise the logic.
introduce a status variable to identify
the condition precisely.
2024-05-18 18:10:50 +09:00
Hermet Park
7e5800df89 renderer/engines: added mainSurface() interface.
This interface expects the main surface of the raster engine.
2024-05-18 18:10:50 +09:00
Sergii Liebodkin
46041111d8 wg_engine: Text support
[issues 1479: Text](#1479)

EvenOdd fill rule reorganized: using global bbox of whole path for fill
2024-05-18 18:10:28 +09:00
Mira Grudzinska
7581b08c69 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-05-17 23:10:10 +09:00
Hermet Park
f02fccf57c 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-05-16 19:41:56 +09:00
Mira Grudzinska
dc6ddd83f5 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-05-16 17:50:37 +09:00
Jinny You
baaae5e416 test/lottie: added the slot resetting in animated property case 2024-05-16 17:46:54 +09:00
Mira Grudzinska
3b22f008f7 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-05-16 17:00:10 +09:00
Hermet Park
dd091f4e0c lottie: fix compiler warnings. [-Wsign-compare] 2024-05-16 13:50:15 +09:00
Mira Grudzinska
3077d983e6 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-05-16 12:51:16 +09:00
Mira Grudzinska
638f42f19e 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-05-16 12:51:11 +09:00
Hermet Park
f53a331558 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-05-15 14:54:41 +09:00
Hermet Park
03d2505b0a wg_engine: code refactoring
Use the override specifier so that
a compiler could warn any human mistake.
2024-05-14 17:14:32 +09:00
Hermet Park
430a6b4ad7 lottie: refactoring key frame logic.
compare floating-point values properly
to avoid potential precision loss.
2024-05-14 15:28:48 +09:00
Hermet Park
ad183c0586 test/animation - added a frame counting test-suite. 2024-05-14 15:28:48 +09:00
Hermet Park
38bd34b01f animation/lottie: improved the precision of frame values.
Refined the logic for updating frame numbers
to ensure greater accuracy in value precision.

issue: https://github.com/thorvg/thorvg/issues/2266
2024-05-14 15:28:48 +09:00