Commit graph

2252 commits

Author SHA1 Message Date
Hermet Park
aa90a9a603 examples: show users the best practice usage. 2023-11-10 13:57:29 +09:00
Hermet Park
1adc41291a sw_engine: ++null safety 2023-11-10 12:19:01 +09:00
Hermet Park
f94ce21689 lottie/builder: Fix a broken animation
The animation couldn't be triggered on a single thread.
Regression bug introduced by 29b5bc372d
2023-11-10 12:18:55 +09:00
Hermet Park
4ad1e66ffe lottie/loader: Corrected an issue with the return value when loading fails.
Previously, Picture::load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false)
would return 'Success' even when the data is invalid.

This issue only occurred when the number of threads is set to 0.
2023-11-10 12:18:47 +09:00
Hermet Park
8a5d14c6b5 gif: corrected the wrong aspect ratio scaling. 2023-11-06 20:18:52 +09:00
Hermet Park
99b57dc2b8 saver/gif: Fix a clipping issue.
The Lottie loader missed handling the base clipper resizing.
This patch addresses the issue.
2023-11-06 20:17:48 +09:00
Hermet Park
1b80e3e460 saver/gif: up to date the gif encoder.
this fixes the memory sanitizer report:

../src/savers/gif/gif.h:315:31: runtime error: index 255 out of bounds for type 'unsigned char [255]'
../src/savers/gif/gif.h:113:54: runtime error: index 255 out of bounds for type 'unsigned char [255]'

Issue: https://github.com/thorvg/thorvg/issues/1758
2023-11-06 20:17:42 +09:00
Hermet Park
4588fe1119 binding/wasm: remove layer functionality.
We will revisit this function later with a proper design.
2023-11-06 20:17:35 +09:00
Hermet Park
b4808103cf binding/wasm: updated save features
- removed the compression option
- added an animation save function.
2023-11-06 20:17:29 +09:00
Hermet Park
28d070aa1b binding/wasm: updated save features
- removed the compression option
- added an animation save function.
2023-11-06 20:17:22 +09:00
JunsuChoi
2da608eef2 saver GifSaver: Introduce GifSaver for animation
Add save() API that takes tvg::Animation as a parameter.
This API uses gif.h to create each animation frame as a gif frame.
Gif creation do not support threads because they must be added sequentially.
Please see example/GifSaver.cpp

ex)
auto animation = tvg::Animation::gen();
auto picture = animation->picture();
picture->load(EXAMPLE_DIR"/walker.json");
auto saver = tvg::Saver::gen();
saver->save(std::move(animation), EXAMPLE_DIR"/test.gif");
saver->sync();

New API:
Result Saver::save(std::unique_ptr<Animation> animation, const std::string& path, uint32_t quality = 100, uint32_t fps = 0);

Issue: https://github.com/thorvg/thorvg/issues/1712
2023-11-06 20:16:32 +09:00
RuiwenTang
5949a994c8 gl_engine: fix memory out of bounds error in GlGpuBuffer
If buffer data is larger than memory alignment, need to make sure there
is enough memory in current stage buffer
2023-11-03 17:04:41 +09:00
Hermet Park
bcb35ba33b renderer: maintain consistency in the logging domain. 2023-11-03 17:04:19 +09:00
Hermet Park
4070495032 loaders/png: fixed data conversion warnings on Windows
../src/loaders/external_png/tvgPngLoader.cpp(110): warning C4244: '=': conversion from 'float' to 'uint32_t', possible loss of data
../src/loaders/external_png/tvgPngLoader.cpp(111): warning C4244: '=': conversion from 'float' to 'uint32_t', possible loss of data
../src/loaders/external_png/tvgPngLoader.cpp(112): warning C4244: '=': conversion from 'float' to 'uint32_t', possible loss of data
2023-11-03 17:04:04 +09:00
Hermet Park
1beec19586 renderer: ++safety
these member values can be accesssed without update() call.
2023-11-03 17:03:46 +09:00
Hermet Park
914621ebde wasm: fix a regression bug.
The Animation::frame() method has been modified.
It will now return InsufficientCondition,
if the frame value is the same as the previous one.

In addition to this change, we have also updated its usage accordingly.
2023-11-03 17:03:36 +09:00
Hermet Park
26cf0f47cd bump up version v0.11.3 2023-10-27 14:21:34 +09:00
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