Commit graph

2273 commits

Author SHA1 Message Date
Hermet Park
4b4514a8b0 wg_engine: add the wgpu_native library dependency.
about the wgpu-native please visit:
https://github.com/gfx-rs/wgpu-native/releases
2024-06-24 14:45:19 +09:00
Hermet Park
28ac09648e common: fix a crash on CI windows test.
it's a vs2022 17.10 stl known issue.
https://github.com/microsoft/STL/wiki/Changelog
2024-06-24 14:44:58 +09:00
Mira Grudzinska
70c2260cfb svg_loader: handle text node
The text node is handled, but default values
of the font-family and font-size as used in
the user's system are not.
For now font has to be loaded by the user.

@Issue: https://github.com/thorvg/thorvg/issues/2350
2024-06-24 14:44:52 +09:00
Hermet Park
d928c93239 renderer: optimize the ClipPath fast-track.
this optimization applies when the clipper is
not an axis-aligned rectangle under the following conditions:

a. Coverage where the clipper is a regional superset of the viewport.
b. Coverage where the clipper is completely outside of the viewport.

issue: https://github.com/thorvg/thorvg/issues/2332
2024-06-24 14:44:21 +09:00
Hermet Park
5a6d31a2e9 renderer: code clean up 2024-06-24 14:44:15 +09:00
Hermet Park
0cf840fbd4 common/math: added minor math functions. 2024-06-24 14:44:05 +09:00
Mira Grudzinska
b95fa3a7bd sw_engine: fix fastTrack condition
When checking the fastTrack condition,
it's necessary to exclude the outlines
with a Bezier curve (Move-Cubic-Line,
Move-Cubic-Close, Move-Line-Cubic).

@Issue: https://github.com/thorvg/thorvg/issues/2379
2024-06-24 14:43:54 +09:00
Mira Grudzinska
733f0996d8 docs: resolve doxygen warnings 2024-06-24 14:43:48 +09:00
Hermet Park
3c3ad144a7 Revert "sw_engine: revert the threshold."
This reverts commit dad797445b.

Misidentified the key issue. It will be reviewed again.
2024-06-24 14:43:07 +09:00
Hermet Park
f9c86fc38a sw_engine: revert the threshold.
Somehow, it breaks the window unit-test, revert the value.

regression by: 51a2936b28
2024-06-24 14:43:00 +09:00
Hermet Park
7fd552fab0 sw_engine: fine-tuning RLE performance.
the arranged value is examined with the local test,
improved the speed twice for a corner-case that
extreamly huge size shape.
2024-06-24 14:42:54 +09:00
Hermet Park
d5f41c85d3 api: corrected return type.
NonSupport indicates unsupported options due to disabled features
or lack of system support. InvalidArgument indicates the case
such as incorrect parameter values.
2024-06-24 14:42:46 +09:00
Jinny You
8a1a3e54ee lottie: Add exception for lottie doesn't have exported glyph
Added handling logic for missing characters to prevent program hang.
2024-06-24 14:42:33 +09:00
Mira Grudzinska
f0b0ea3edb sw_engine: fix trimming
For the 'simultaneous' trimming option, the maximum
stroke length from all subpaths was determined and
used to scale the trim of each subpath. As a result,
if the subpaths had different lengths, this scaling
was incorrect.
Now, the length is determined separately for each
subpath and is used to scale the trimming of its stroke.

@Issue: https://github.com/thorvg/thorvg/issues/2335
2024-06-24 14:42:25 +09:00
Jinny You
2f26dc33a9 lottie: Fix invalid font match
When Lottie has similar font names, it incorrectly matches fonts due to a logic bug.

This error causes an infinite loop when searching for glyphs.
2024-06-24 14:42:19 +09:00
Mira Grudzinska
61de65e10b common: clarification of returned types
The functions setting stroke's features always
returned a true. Returnig a boolen was a remnant
from a previous implementation. Since now they
never return false, they can be void functions.
The APIs description has been corrected.
2024-06-24 14:42:12 +09:00
Mira Grudzinska
710fa22d50 capi: bindings for strokeTrim
Example Capi.cpp modyfied.
2024-06-24 14:41:15 +09:00
Mira Grudzinska
e6f4b5a2a8 common: strokeTrim api introduced
New api sets/gets the trim of the stroke
along the defined path segment, allowing
control over which part of the stroke is
visible.

@issue: https://github.com/thorvg/thorvg/issues/2190
2024-06-24 14:37:53 +09:00
Mira Grudzinska
bdd506bbb8 lottie: fix matte layer finding
Layer identifiers do not have to be unique within
the entire file - they are unique within a given
group. Searching the entire composition to find
the referenced matte was an incorrect approach.

Error introduced by 1ee79a6c2a

@Issue: https://github.com/thorvg/thorvg/issues/2349
2024-06-24 14:37:29 +09:00
RuiwenTang
059c452249 gl_engine: fix gradient color interpretation error
Fix when gradient position is same as some starting or ending point
of a gradient stop, the output color is blank
2024-06-24 14:37:22 +09:00
Sergii Liebodkin
eadf66e178 wg_engine: fix color buffer corruption with wgpu-opengl wrapper (linux)
In a case of usage stencil buffer only we need to turn off an color target writes. In other case color buffer fill be filled by unxepcted color if fragment shader did not return any value.
It happens in a case on OpenGL realization of webgpu, that used in linux

Befire:

After:
2024-06-24 14:37:15 +09:00
Martin Capitanio
839ffe40c6 svg_loader: Add embedded webp mime type
Fixes loading _webp_ images embedded in SVG.
2024-06-24 14:37:09 +09:00
RuiwenTang
1879a2ff0e gl_engine: fix GradientStroke ignored by tessellator
Fix the GlRenderer not take GradientStroke into consider when prepare
Geometry vertices.
2024-06-24 14:36:51 +09:00
Mira Grudzinska
f14be7c33b common: fix typos & remove unused var 2024-06-24 14:36:43 +09:00
Mira Grudzinska
5e9b07ea54 lottie: parsing obj property inside this obj
Shape's property 'direction' should be parsed
together with other properties specific for
the shape. This solves the issue with direction-
it wasn't working.
2024-06-24 14:36:36 +09:00
Mira Grudzinska
c88d6cbdf3 sw_engine: fix dashing
Fixing the problem with handling a specific
case where the length of the remaining line
to be drawn and the dash line length were
exactly the same
2024-06-24 14:36:29 +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
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
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
Abdelrahman Ashraf
3a2183dfa7 fix: 🐛 missing binding for tvg_canvas_set_viewport c api 2024-06-24 14:32:03 +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
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
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