Commit graph

2235 commits

Author SHA1 Message Date
Hermet Park
28acef19a2 portability: addressed all compilation warnings from MSVC 2023-10-27 14:21:34 +09:00
Hermet Park
ae67a126e1 lottie: fixed all memory access violations. 2023-10-27 13:51:13 +09:00
Hermet Park
d60b5b1721 renderer/paint: added a blend update flag.
Keep track of the update changes accurately.
We can utilize this value change in the backend engine.
2023-10-27 12:28:47 +09:00
Hermet Park
9b9889b228 lottie/builder: enable layer blending
Issue: https://github.com/thorvg/thorvg/issues/1737
2023-10-27 12:28:40 +09:00
Hermet Park
4ad0b79eec renderer: revise the internal paints structure.
Get rid of the polymorphism function table,
use the switch directly instead.

We profiled, both binary & performance is better than before.

Tested on a local machine (single thread):
- Lottie: 2ms improved
- Binary: -0.5kb
2023-10-27 12:28:32 +09:00
Hermet Park
fe259d0414 lottie: ++optimization with a caching effect.
reuse clippers if they are available.

Binary: +132
2023-10-27 12:27:47 +09:00
Hermet Park
f223f2f6ac lottie: introduced static layer cache.
lottie builder doesn't need to rebuild the layer object
if it has no any animation frame data.

That case, we can cache the layer scene in order to reuse it.

Tested on local machine (single thread):
- Lottie: appx. 2ms enhanced.
- Binary: +204
2023-10-27 12:26:35 +09:00
Hermet Park
b001c0736c renderer/shape: enable returning count values only 2023-10-27 12:24:20 +09:00
Hermet Park
c71ae85953 lottie: clean up code
no logical changes, only code clean-up
2023-10-27 12:24:12 +09:00
Hermet Park
7b323e5749 canvas/paint: ++exception handling
enhanced reference count verification
to prevent unintentional deletion of used composition targets.
2023-10-27 12:24:01 +09:00
Hermet Park
dc02e131e9 animation/lottie: updated the frame count unit.
replace the frame count unit from the int32_t to float
since animations could smoothly interpolate key-frames.

This notificably improve the animation smoothness in Lottie

Beta API changes:
Result Animation::frame(uint32_t no) -> Result Animation::frame(float no)
uint32_t Animation::curFrame() const -> float Animation::curFrame() const
uint32_t Animation::totalFrame() const -> float Animation::totalFrame() const
2023-10-27 12:23:38 +09:00
Hermet Park
e17cc45ba8 examples/lottie: added more show cases 2023-10-27 12:22:35 +09:00
Hermet Park
63613992c4 sw_engine/raster: optimized the scaled image rasterization
Unified common logic for scaled image raster operations,
Avoid on-spot pixel computation as possible.

Tested on local machine (single thread)

Lottie: 0.057s -> 0.053s (-0.004s)
2023-10-27 12:17:58 +09:00
Hermet Park
35ddc5fe56 sw_engine/math: fine-tuning optimization
Try to minimize the use of sqrt() and arctan() calls
when possible. These calls can be relatively expensive
when accumulated within a single frame.

Also repalce the division with shift operation.
since split cubic function is one of the significant hot-spots
in the data processing, we could earn a noticable enhancement.

Tested on single thread local machine:

Lottie: 0.080 -> 0.052s (-0.028s)
Performance: 0.023 -> 0.022 (-0.001s)
Binary: +34
2023-10-27 12:17:30 +09:00
Hermet Park
7cccabad40 sw_engine/math: Enhance trigonometric functions.
Streamlining computations with floating-point operations in rotation
thereby improving 'thorvg' speed.

Also use the well-optimized posix math functions instead of
custom math.

Test on my local machine.

Lottie: -0.008s (0.073 -> 0.065)
Performance: -0.0013s (0.0154 -> 0.0141)
Binary: -323
2023-10-27 12:17:13 +09:00
Hermet Park
b01fe9bf44 bump up version v0.11.2 2023-10-20 13:32:13 +09:00
Hermet Park
5a57c76386 sw_engine raster: fixed a default alpha blending bug.
alpha value has been missed by a mistake,
a regression by c50d2fd

Issue: https://github.com/thorvg/thorvg/issues/1716
2023-10-20 13:31:33 +09:00
Hermet Park
3fb37dd42a lottie: Fixed trimpath to support simultaneous trimpath
The previous version omitted support for simultaneous trimpath,
but it is now working as intended.
2023-10-20 13:31:09 +09:00
Hermet Park
0f334b48bb lottie/builder: Fix overlapped stroking outlines.
Previously, the builder accumulated the outlines and fills
in one paint to reduce the rendering context.

However, this approach won't work for Lottie
if the resource contains multiple strokes with branched groups.

We should apply the optimization
only when the specified condition is satisfied.
2023-10-20 13:31:03 +09:00
Martin Capitanio
b655dd8094 loader/jpg: Fix a regression bug.
Fixes #1705
2023-10-20 13:30:53 +09:00
Hermet Park
ca00e52125 bump up version v0.11.1 2023-10-13 14:35:03 +09:00
Hermet Park
ea3de694d0 lottie/builder: fix a regression bug.
currently thorvg doesn't support full 3d transformation.
orthogonal projection is mandatory.

Issue: https://github.com/thorvg/thorvg/issues/1698
2023-10-13 14:32:25 +09:00
Martin Capitanio
1112dc91dc loader/svg: Fix maskContentUnits userSpaceOnUse/objectBoundingBox
Fixes #1694
2023-10-13 14:31:51 +09:00
Hermet Park
12f2f2db44 lottie/builder: revise the render context for saving memory.
Allocate repeater context only when it's valid.
2023-10-13 14:31:21 +09:00
Hermet Park
d36777cf44 Lottie: Fixed handling of multiple strokes in one layer.
Revised the rendering logic of Lottie by creating a new rendering context
using a queue when multiple strokes are requested.

Issue: https://github.com/thorvg/thorvg/issues/1642
2023-10-13 14:31:12 +09:00
Hermet Park
3d06d5552f sw_engine/stroke: enhanced the quality of the dash line corners.
Previously, the engine didn't properly cover the dash line corner styles
because it considered a new line to start at the corner.

This update modifies the logic to recognize curved lines
as a single line, including the corners.

There may still be some quality issues,
but it's an improvement over the previous version.

@Issue: https://github.com/thorvg/thorvg/issues/121
2023-10-13 14:31:02 +09:00
Hermet Park
12260198d1 release: bump up version v0.11.0 2023-09-28 08:30:34 +09:00
Hermet Park
b0f6640bca docs: updated to v0.11
In this update, we have chosen not to include CAPIs.
This decision was made due to the mixture of C++ and C languages
in a single documentation category, which resulted in a messy presentation.

Also, In this update, we have removed 'doxygen-awesome-css'
and introduced our own designated styles located in the 'style' folder.
After generating the Doxyfiles, we can overwrite the styles with these new ones.
2023-09-27 11:18:25 +09:00
Hermet Park
ba84771cce
Update README.md 2023-09-26 22:46:26 +09:00
Hermet Park
0e3b3d3095
Update README.md 2023-09-26 22:43:38 +09:00
Hermet Park
2b7c47f2b5
doc/capi: updated 2023-09-26 19:06:57 +09:00
Hermet Park
5ecd3fb479 sw_engine: Correct the color conversion condition.
The color conversion is supposed to take into account the differences between
straight alpha premultiplied color and pre-multiplied alpha color.

The previous logic does not perfectly cover these conditions.

The problem was occured in the thorvg viewer with a jpeg bgra format.
2023-09-26 18:57:34 +09:00
Hermet Park
e8fd7e2b85 infra: update the tvg binaries. 2023-09-26 17:42:17 +09:00
Hermet Park
51c3a8912c sw_engine: fix an invalid memory access.
the surface and mesh data can be missed by an invalid condition.
this fixes an invalid memory access problem.

Issue: https://github.com/thorvg/thorvg/issues/1671
2023-09-26 17:41:08 +09:00
Hermet Park
92b6f9dc48 examples: remove Async test
We have alternative test cases for it such as Lottie
2023-09-26 14:50:16 +09:00
Hermet Park
e4ade98e8c sw_engine: fix a regression stroke bug
reverted changes that occurred this issue from d683d2e

Issue: https://github.com/thorvg/thorvg/issues/1670
2023-09-26 14:26:57 +09:00
Hermet Park
7ec969be29 lottie/builder: Fix incorrect stroke width scaling propagation.
The transform (scale) should be applied to the following drawing elements,
not the previous stroke.
2023-09-26 14:24:52 +09:00
Hermet Park
74b67919e0 tvg: support radial gradient focal properties
properly store/restore the radial gradient focal properties
from the tvg loader and saver
2023-09-26 13:05:27 +09:00
Hermet Park
ed23b432bb tvg: support dash offset property
properly store/restore the dash offset property
from the tvg loader and saver

Issue: https://github.com/thorvg/thorvg/issues/1617
2023-09-26 13:05:27 +09:00
Hermet Park
c7123a1547 test: enhanced the unit-test coverage
supplements animation/lottie/sw_engine test cases.

updated the page: https://github.com/thorvg/thorvg/wiki/Unit-Tests

Issue: https://github.com/thorvg/thorvg/issues/1669
2023-09-26 10:48:33 +09:00
Hermet Park
fdd90605c7 lottie/builder: fix a memory leak.
fixed a memory leak in an exceptional case.
2023-09-26 10:48:33 +09:00
Hermet Park
1819fed033 renderer/paint: fixed a mismatched reference count.
This correction ensures a consistent use of 'ref' and 'unref' for paints to release memory properly.
The memory leak occurred when a picture was not pushed to a valid canvas.

This issue was reported by the unit-test memory sanitizer.
2023-09-26 10:48:33 +09:00
Hermet Park
2fb0cc8309
Update README.md 2023-09-26 01:29:47 +09:00
Hermet Park
2f1873f04e test/capi: update unit tests
added a Tvg_Composite_Method::TVG_COMPOSITE_METHOD_NONE case
2023-09-25 21:33:23 +09:00
Hermet Park
ac82234360 capi: api sync up.
added beta apis:
- enum Tvg_Composite_Method::TVG_COMPOSITE_METHOD_INVERSE_LUMA_MASK;

promote apis:
- TVG_API Tvg_Result tvg_shape_set_stroke_miterlimit(Tvg_Paint* paint, float miterlimit);
- TVG_API Tvg_Result tvg_shape_get_stroke_miterlimit(const Tvg_Paint* paint, float* miterlimit);

@Issue: https://github.com/thorvg/thorvg/issues/1669
2023-09-25 21:33:23 +09:00
Hermet Park
0f5f43db1e apis: promote beta apis to the official ones.
- enum class CompositeMethod::InvLumaMask;
- template<typename T> std::unique_ptr<T> cast(Paint* paint);
- template<typename T> std::unique_ptr<T> cast(Fill* fill);

@Issue: https://github.com/thorvg/thorvg/issues/1669
2023-09-25 21:33:23 +09:00
Hermet Park
44d0f98274 examples/capi: added an animation example. 2023-09-25 12:27:22 +09:00
Hermet Park
749523b709 capi/animation: support animation features under the beta.
New APIs:
- Tvg_Animation* tvg_animation_new();
- Tvg_Result tvg_animation_set_frame(Tvg_Animation* animation, uint32_t no);
- Tvg_Paint* tvg_animation_get_picture(Tvg_Animation* animation);
- Tvg_Result tvg_animation_get_cur_frame(Tvg_Animation* animation, uint32_t* no);
- Tvg_Result tvg_animation_get_total_frame(Tvg_Animation* animation, uint32_t* cnt);
- Tvg_Result tvg_animatoon_get_duration(Tvg_Animation* animation, float* duration);
- Tvg_Result tvg_animation_del(Tvg_Animation* animation);
2023-09-25 12:27:22 +09:00
Hermet Park
dc9e14a20f lottie/model: revise the color stop population logic.
The omitted data must be generated with interpolation.
This change supplements that logic.
2023-09-25 11:04:20 +09:00
Hermet Park
dc67c405f8
infra/gitaction: hotfix system buid fail. 2023-09-22 16:25:26 +09:00