Commit graph

3014 commits

Author SHA1 Message Date
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
Hermet Park
a3fe9c25f2 wg_engine: code refactoring
Use the override specifier so that
a compiler could warn any human mistake.
2024-06-24 14:14:02 +09:00
Hermet Park
06553966e1 test/animation - added a frame counting test-suite. 2024-06-24 14:13:52 +09:00
Hermet Park
827a00b076 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-06-24 14:12:00 +09:00
Mira Grudzinska
b2be63a2d3 test: fix margin value
The precision margin for the comparison
has been set to 0.01f instead of 004004.
2024-06-24 14:11:54 +09:00
Jinny You
f00d3b5627 lottie/slot: Fix slot resetting bug
When resetting back to animated property, system causes an UAF because frames have been freed.

Mark frames in nullptr at the case, so it doesn't use frame data after freed.

Issue: #2255
2024-06-24 14:11:48 +09:00
Hermet Park
edbd2d7728 gl_engine: updated GLES minimum requirement from v2 to v3
GLES v3 was introduced many years ago;
we are now dropping support for GLES v2.

issue: https://github.com/thorvg/thorvg/issues/2269
2024-06-24 14:11:32 +09:00
Hermet Park
eeb06870a0 lottie: fixed a memory leak
Free the children data properly,
rarely observerd this, only when a layer is hidden.
2024-06-24 12:36:47 +09:00
Hermet Park
362faa3c9a common: tweaking bezier computation for perf.
It will sacrifice precision that is not noticeable
and instead try to improve performance.

Approximately 5% has beeen improved at Lottie example
2024-06-24 12:36:40 +09:00
Hermet Park
63705d9f04 examples/lottie: updated resources 2024-06-24 12:36:30 +09:00
Hermet Park
293d0ef037 lottie: code refactoring.
text tracking is an optional property.
it's good to initialize it with 0.
2024-06-24 12:36:23 +09:00
Jinny You
45b3583ad2 lottie/text: Support text tracking
Text Tracking value("tr") is parsed and never used.

Calculate text spacing size via the tracking offset.

Issue: #2254
2024-06-24 12:36:14 +09:00
JunsuChoi
6249263d2a example: Sync setting size and window default size
When WIDTH and HEIGHT values change,
the default size of the window also changes.
2024-06-24 12:36:04 +09:00
Hermet Park
13b46c41d2 common/array: ++safety
do not try memory copy if the size is 0.
2024-06-24 12:35:56 +09:00
Mira Grudzinska
dcf6ebcf18 svg_loader: move the display property to the style
The display property, like any other node's style property,
should be part of a node style. This ensures its correct
copying and inheritance.
For the 'symbol' node, which is not rendered unless it is
used within a 'use' node, the display property can also be
applied. Because of that it cannot be utilized during scene
construction to determine whether the symbol is being defined
or used within a 'use' context.
2024-06-24 12:35:42 +09:00
Hermet Park
c614efec3d lottie/expressions: fix a build break on windows. 2024-06-24 12:35:33 +09:00
Hermet Park
89d0f44eb9 lottie/expressions: fixed a memory access violation.
Reset memory after freeing the singletone instance.
2024-06-24 12:35:27 +09:00