Commit graph

2486 commits

Author SHA1 Message Date
Hermet Park
adbc929ced bump up version 0.12.6 2024-02-23 12:26:46 +09:00
Hermet Park
d9120b9dee examples: ++threading stability.
Ensure synchronous calls are made after updating the canvases.
2024-02-23 12:26:46 +09:00
Vincent Torri
c1ea9d4585 Lottie loader: fix compilation on windows
strlen() was used in tvgLottieModel.h without the inclusion of
cstring. This patch fixes this
2024-02-23 11:45:11 +09:00
JunsuChoi
a92633e1d8 svg: Improve valid check for url(#id)
Improve parenthesis checking and space checking.
 - There must be only one pair of parentheses.
 - There cannot be spaces(and ') between id strings.

Issue: https://github.com/thorvg/thorvg/issues/1983

Co-authored-by: Hermet Park <hermet@lottiefiles.com>
2024-02-23 11:45:05 +09:00
Mira Grudzinska
f14d4168e9 sw_engine: Increasing accuracy for dashed curves
Dashed curves require greater precision in calculating
their lengths and while splitting Bezier curves.
Otherwise, it results in visual discrepancies compared
to the expected outcomes.
Approximate functions 'bezLengthApprox' and 'bezAtApprox'
used for calculations in the lottie loader.

issue: https://github.com/thorvg/thorvg/issues/1686
2024-02-23 11:44:29 +09:00
Mira Grudzinska
cdc7fca9b5 sw_engine: fixing stroke outline
In the case of non-uniform scaling for
thick strokes, artifacts were visible.
The calculations took into account the angle
resulting from the already transformed points,
whereas the untransformed points should have
been considered - the transformation is taken
into account in the next step.

@issue: https://github.com/thorvg/thorvg/issues/1915
2024-02-23 11:44:22 +09:00
Hermet Park
5c130c6848 lottie/parser: clean up the exception handling mechanisms.
Since the parser has become stable enough,
remove the exceptions and instead rely on parser error handling.
2024-02-23 11:44:09 +09:00
Hermet Park
9e4331fe5c loader/webp: do not expose webp apis.
this reduces the bin size around -1.5kb
2024-02-23 11:40:33 +09:00
Hermet Park
1c4a25cb4a lottie: remove the duplicated binary search logic. 2024-02-23 11:40:24 +09:00
JunsuChoi
92200449e8 loader/svg: Fix empty id to null
empty id is invalid. Therefore, set it to null and make it is not used.

issue: https://github.com/thorvg/thorvg/issues/1977
2024-02-23 11:40:16 +09:00
Martin Capitanio
a5cc5a3894 Portability: Fix compiler shadowing warning 2024-02-23 11:39:47 +09:00
Hermet Park
9c8eeaab96 bump up version 0.12.5 2024-02-07 20:41:08 +09:00
Hermet Park
0fb1acdc70 webp: removed non-existing symbol methods. 2024-02-07 20:40:53 +09:00
Hermet Park
a39e70fb88 loaders: enhance decoding efficiency
enhance decoding efficiency by determining the desired canvas format
during image loading. This allows loaders to preemptively decode
the image in the specified format, to not convert the format again.
2024-02-07 20:40:53 +09:00
Hermet Park
886b6b365b loaders: decode the image with premultiplied alpha.
basically, the renderer requires images with premultiplied alpha.
2024-02-07 20:40:53 +09:00
Hermet Park
ccb5a5d1fb Revert "lottie: compatibility++"
This reverts commit c89f6253bf.

No more valid by 3f235d9e3f
2024-02-07 20:40:53 +09:00
Hermet Park
040de02cef renderer/loader: enhance picture format compatibility
Attempt to load a given file/data using candidate formats
when the desired loader fails. This approach will enhance
the compatibility with various file formats in unexpected scenarios.

Previously, we had removed this feature, but have since
recognized its necessity due to the impact on file data
in specific corner cases.
2024-02-07 20:40:53 +09:00
Junsu Choi
ce7f4cb7c3 loader/webp: Support static webp loader
Built to libwebp code in to support the static option of webp loader.
Code from :https://github.com/jacklicn/libwebp

This forking version only contains the minimal webp decoding feature.

Binary Size: +68kb

Co-authored-by: Hermet Park <hermet@lottiefiles.com>

issue: https://github.com/thorvg/thorvg/issues/1427
2024-02-07 20:40:50 +09:00
Hermet Park
27fa576884 sw_engine: Improve image up-scaler quality
Adjusted the sampling position basis by -0.5 pixel
to enhance edge line interpolation quality.

This change addresses an issue with the image up-scaling process,
resulting in clearer and more accurate visuals.

issue: https://github.com/thorvg/thorvg/issues/1949
2024-02-07 20:35:34 +09:00
Hermet Park
bf4654a991 renderer: ensure canvas rendering continues despite invalid scene parts
Previously, the logic was set to halt rendering when any part of the paints,
particularly bitmap-based images, failed to render.

This update modifies the behavior to continue drawing the scene,
allowing for the successful rendering of other elements.

issue: https://github.com/thorvg/thorvg/issues/1951
2024-02-07 20:35:26 +09:00
Hermet Park
331839d493 bump up version 0.12.4 2024-02-02 12:46:19 +09:00
Hermet Park
fc38a4cb24 lottie/parser: shutdown a compiler warning.
corrected a data type.
2024-02-02 12:46:19 +09:00
Hermet Park
4b33721738 examples: updated DirectUpdate sample
Properly guide a sample usage to guarantee the sync call.
2024-02-02 12:30:24 +09:00
Hermet Park
1748b59257 lottie: fixed a parsing error in assets
An unused key in assets parsing corrupted the sequence.
This change now ensures they are tightly ignored.
2024-02-02 12:15:27 +09:00
Hermet Park
684a0140ba lottie: fix a simple mistake. 2024-02-02 12:15:27 +09:00
Hermet Park
6077e071d4 renderer: code refactoring.
removed unnused return value.
2024-02-02 12:15:27 +09:00
Hermet Park
f9316fac49 renderer: destroy engines safely.
Introduced a reference count to destroy it safely.
2024-02-02 12:15:27 +09:00
Hermet Park
c2fa4a728b renderer: revise the internal logic.
dispose of the resources at the end of the paint deletion.
This will help retain the resources of the retained paints
and reuse them after reconstructing the next scene.
2024-02-02 12:15:24 +09:00
Hermet Park
dd48a4155e renderer: code refactoring.
replaced references with pointers to ensure consistency.
no logical changes.
2024-02-02 11:56:58 +09:00
Hermet Park
d7003505f3 lottie: minor optimization.
remove an unnecessary scene in the lottie render tree.
2024-02-02 11:53:57 +09:00
Hermet Park
5eac5622c0 lottie: compatibility++
retry image loading with the given candidates,
even if the suggested format is mismatched.
2024-02-02 11:53:44 +09:00
Hermet Park
77669d6d0e lottie: corrected text height alignment issues.
enhanced support for a wider range of text use cases.
2024-02-02 11:51:34 +09:00
Hermet Park
6c7ca743be lottie: Fixed a font/glyph parsing error.
Previously, the Lottie parser expected a specific parsing order:
font followed by glyph, for optimal data processing.

However, since this order is not guaranteed,
we have revised the parsing logic to accommodate any order.
2024-02-02 11:51:27 +09:00
Hermet Park
a88f7094c4 sw_engine: Address a corner case in trim path handling
This update fixes an issue where duplicated overlapping curves/lines,
when introduced as a single line.
That case overlapping command operation is take account for
the trim path's path-building process.

We now skip such cases to ensure the trim path functions correctly.

issue: https://github.com/thorvg/thorvg/issues/1939
2024-02-02 11:51:22 +09:00
JunsuChoi
07b11e0528 loader/svg: Fix zero check of arc's rx and ry
Please refer to the specifications.
https://www.w3.org/TR/SVG/paths.html#ArcOutOfRangeParameters

If either rx or ry is 0, then this arc is treated as a straight line
segment(a "lineto") joining the endpoints.
2024-02-02 11:51:17 +09:00
JunsuChoi
fc5ca21dea loader/svg: Apply specification of out-of-range elliptical arc parameters
The three specifications below apply.

Specification: https://www.w3.org/TR/SVG/paths.html#ArcOutOfRangeParameters

-
If the endpoint (x, y) of the segment is identical to the current point
(e.g., the endpoint of the previous segment),
then this is equivalent to omitting the elliptical arc segment entirely.

-
If either rx or ry is 0, then this arc is treated
as a straight line segment(a "lineto") joining the endpoints.

-
If either rx or ry have negative signs, these are dropped;
the absolute value is used instead.
2024-02-02 11:51:08 +09:00
Hermet Park
9d79f0ccef bump up version 0.12.3 2024-01-26 11:56:45 +09:00
Hermet Park
ac08d83211 lottie: rectified scene building Logic
resolved a corner case where assets were being attached
multiple times during scene building. This issue was causing
a significant performence drop in image animation
in certain scenarios.
2024-01-26 11:51:52 +09:00
Hermet Park
68ecd61ef7 lottie: fixed an issue with missing stroke drawing
Resolved a problem where the context was missing in scenarios
involving an overlapped stroke drawing.

issue: https://github.com/thorvg/thorvg/issues/1933
2024-01-26 11:51:25 +09:00
Hermet Park
adf92beef5 renderer/shape: rectified the round rectangle start position.
adjusted the starting position of the rounded rectangle to 90 degrees
to ensure compatibility with the Lottie trim path effect.

This modification follows the earlier circle correction applied to the rectangle.

issue: https://github.com/thorvg/thorvg/issues/1933
2024-01-26 11:50:01 +09:00
Hermet Park
25b6811354 sw_engine: Rectified dash line drawing issue.
Omit the dash line when its length falls below a minimal threshold.
This threshold is set to less than 0.0001 times the pixel size.
2024-01-26 11:49:53 +09:00
Hermet Park
e353e588fa svg_loader: code refactoring
removed duplicate matrix multiply function.
2024-01-26 11:49:42 +09:00
Mew Pur Pur
bdb522d15f svg_loader: Add missing implementation of skewX and skewY in transform-list 2024-01-26 11:49:35 +09:00
Hermet Park
10ad8bad36 sw_engine: fix a regression bug
invalidate cached compositors when target size is changed.
compositors must be re-initialized with a new size.

regression bug by ca3c1fc1b9
2024-01-19 17:03:22 +09:00
Hermet Park
fcb8f813ff bump up version 0.12.2 2024-01-18 23:56:42 +09:00
Hermet Park
ca3c1fc1b9 sw_engine: retain the compositor cache memory
The compositor memory is likely to be reused in the next frame.
To enhance performance, it is advisable to retain this memory by default.

We may consider introducing a cache policy interface in the Initializer.
This would allow users to manage the Canvas memory more effectively.

Anyhow, this improves the Lottie example performance by 10%
2024-01-18 23:56:42 +09:00
Hermet Park
2a105de9e8 sw_engine: tweak the image down-scaler.
Adjust the sampling count according to the scale ratio.

This significantly improves performance
while making it hard to recognize any loss in image quality.

Lottie example performance has improved by 15%.
2024-01-18 23:56:42 +09:00
Hermet Park
9c725e64b2 sw_engine: removed redundant logic.
Basically, sw_engine uses a desinated memory pool,
this reservation is not so effective.
2024-01-18 23:56:42 +09:00
Hermet Park
4aa95e70b4 lottie: Improve feature coverage by correctly handling XOR shapes
XOR when the shape's direction property is set to a value of 2.
Currently, the direction property is expected to have
either 1 for clockwise or 3 for counterclockwise orientation.

Just found out the number 2 use-case...
2024-01-18 23:56:42 +09:00
Hermet Park
2eddfe2f15 examples: revise the usage.
Remove the canvas buffer clear call
when the solid bg is introduced.
2024-01-18 23:56:42 +09:00