Vincent Torri
edf1f56c67
include missing headers for strcmp(), strdup() and realloc()
2023-12-13 10:33:52 +09:00
Hermet Park
0aa39111ad
common/array: code refactoring.
...
Use a default constructor with reservation.
2023-12-13 09:34:44 +09:00
Hermet Park
528ea0d587
renderer/scheduler: --binary size by 2.2kb
...
replace the stl with own lightweight data structures.
2023-12-13 09:03:17 +09:00
Hermet Park
7ab5cb90aa
infra: renamed the folders, images -> resources.
...
these folders might have more than images.
2023-12-12 08:57:44 +09:00
Hermet Park
273850a972
renderer/shape: Apply the magic number kappa to achieve rounded corners.
...
The magic number kappa (0.552284), which is associated with the bezier curve,
has been introduced. This formula is supposed to be applied to the rounded corners
of the rectangle to ensure consistent drawing results.
Issue: https://github.com/thorvg/thorvg/issues/1824
2023-12-11 09:14:46 +09:00
Hermet Park
a9d39eaf56
renderer/loader: optimization++
...
removed the internal unique_ptr usage to reduce the binary size(-553)
2023-12-08 23:35:19 +09:00
Jinny You
914144bb5a
lottie/builder: fix crash by null reference
2023-12-07 17:52:40 +09:00
Jinny You
51c4bc2614
loader/jpg: Fix warning
2023-12-05 17:47:20 +09:00
Sergii Liebodkin
6313fd8948
[Issues 1811: Compiller shadowing warning]( https://github.com/thorvg/thorvg/issues/1811 )
...
Godot CI compilation issue fixed
2023-12-05 07:44:40 +09:00
RuiwenTang
3e9579f92c
gl_engine: support advance compose method
2023-11-24 08:07:21 +02:00
Hermet Park
dd6956a7ac
lottie/builder: revert the clipper cache.
...
This ia a buggy,
We will revisit this optimization with a perfect solution.
2023-11-24 12:56:23 +09:00
Hermet Park
ff6ea4b6c4
Loaders: Introduced a loader cache.
...
The loader cache is applied to conserve memory.
If the input data is already present in loaders,
the loader cache will promptly return the active loader.
This results in a lot of memory savings for the duplicated resources.
binary diff: -400 bytes
2023-11-23 18:21:28 +09:00
Hermet Park
f2c29063d2
api: updated the recent changed api again.
...
Reordered by the data packing size.
Also removed a wrong capi default parameter value.
Result Picture::load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false, const std::string& rpath = "")
-> Result load(const char* data, uint32_t size, const std::string& mimeType, const std::string& rpath = "", bool copy = false)
Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, const char *mimetype, bool copy, const char* resourcePath)
-> Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, const char *mimetype, const char* resourcePath, bool copy);
2023-11-23 11:59:38 +09:00
Hermet Park
9f105b60c4
common: Move the list to the gl_engine side.
...
Unfortunately, the usage of this list is not intuitive,
so can be confusing. Placed it only for gl.
2023-11-22 20:59:58 +09:00
Hermet Park
023d961118
lottie/builder: ++size optimization
...
Replaced std::queue with inlist for optimizing binary size (-1.3kb).
2023-11-22 20:59:58 +09:00
Hermet Park
e89eb09a33
common/inlist: added a inline list data structure.
...
Inline lists mean that their nodes' pointers are part of the same memory as the data.
This has the benefit of fragmenting memory less and avoiding node->data indirection.
2023-11-22 20:59:58 +09:00
Jinny You
c30019e6dd
capi: support loading external image feature for lottie
...
Updated API:
- Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, const char *mimetype, bool copy, const string& resourcePath)
2023-11-22 18:04:35 +09:00
Jinny You
132be91de4
lottie/loader: support external image from memeory lottie
...
I've added new parameter, const string& resourcePath, to load external image on lottie.
Result load(const char* data, uint32_t size, const string& mimeType, bool copy, const string& resourcePath)
Note: tvgLoadModule will have new overrided method `open`, not to effect to other changes except animation.
Issue: #1793
2023-11-22 18:04:35 +09:00
Hermet Park
0c1322fa07
lottie/builder: corrected polystar rotation.
...
There was likely a mistake in the rotation value set;
there was no reason to multiply it by 2.
Issue: https://github.com/thorvg/thorvg/issues/1773
2023-11-22 00:39:02 +09:00
Hermet Park
d25d7f348f
renderer, loader: minor code refactoring.
...
- sync with its file name
- remove unnecessary section comments
- compact binary size (-300)
- private Task::run() methods from the loaders
2023-11-22 00:01:52 +09:00
Hermet Park
4c95ed3e51
Lottie/builder: revert a static cache optimization.
...
There are some matting masking bugs observed,
Reverted the commit. We will revisit it later.
commit d37c500262
Author: Hermet Park <hermet@lottiefiles.com>
Date: Wed Oct 25 18:55:05 2023 +0900
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-11-21 13:05:04 +09:00
Hermet Park
5138a7c914
lottie/builder: hotfix, invalid stroking scaling.
...
There is a buggy workaround code that rewinds the stroke scaling.
Issue: https://github.com/thorvg/thorvg/issues/1730
2023-11-21 11:36:34 +09:00
Sergii Liebodkin
548962f5f8
apis/engines: Revise the clear() buffer behavior.
...
ThorVG has offered an option to clear the buffer since version 1.0.
This is essential when users utilize the canvas target buffer
with the main render target. They share the buffer
and need to draw contents onto the existing contents.
API:
Result Canvas::clear(bool free = true)
-> Result Canvas::clear(bool paints = true, bool buffer = true)
Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool free);
-> Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool paints, bool buffer);
Issue: https://github.com/thorvg/thorvg/issues/1779
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2023-11-20 18:23:00 +09:00
Sergii Liebodkin
5374155048
Add support for textures color space formats
...
[Issues 1479: pictures](https://github.com/thorvg/thorvg/issues/1479 )
Formats supported:
ABGR8888
ARGB8888
ABGR8888S
ARGB8888S
2023-11-20 17:25:40 +09:00
Hermet Park
6d59bc6c66
gif/saver: fix a invalid memory access
2023-11-17 21:28:45 +09:00
Hermet Park
10e566edc1
sw_engine: fixed a bug where strokes were not showing.
...
Basic shapes were trimmed entirely when they were outside of the canvas,
even if they had a big enough stroke to be partially on the canvas.
This fixes the issue.
Issue: https://github.com/thorvg/thorvg/issues/1785
2023-11-17 21:28:45 +09:00
Sergii Liebodkin
9afa1742be
examples: fixed manual loading of binary data (jpg, png, raw ect)
...
To load binary data operations must be performed in binary mode rather than text.
The issue appears on windows platform, especially for PNG loading
2023-11-17 20:46:28 +09:00
Hermet Park
f081e1f6ae
gif/encoder: fixed memory violation.
...
There was an invalid palette data access
when no frame data had been changed, detected by memory sanitizer.
2023-11-17 20:44:53 +09:00
Sergii Liebodkin
25513b591a
wg_engine: introduced images drawing support
...
[issues 1479: pictures](https://github.com/thorvg/thorvg/issues/1479 )
auto picture = tvg::Picture::gen();
picture->load("images/test.png");
picture->translate(0, 0);
picture->size(100, 100);
picture->opacity(255);
canvas->push(std::move(picture));
2023-11-17 19:34:32 +09:00
Hermet Park
ba46790b78
lottie/parser: Fix the shapes parsing logic.
...
Currently, it assumes "ty":"gr" for the related shapes children,
which can be skipped since the children will be in the "it" scope.
Some Lottie data is missing the "ty":"gr" field,
and ThorVG couldn't display the content properly.
It can ignore it with the context understanding.
2023-11-17 14:12:46 +09:00
Hermet Park
41a3702f19
gif/encoder: adjusted alpha transparent threshold 255 -> 127
...
More than half-transparent(50%) pixels will be encoded as well.
2023-11-17 13:28:41 +09:00
Hermet Park
092da69003
saver/gif: memory usage optimization.
...
Use a cache to store the intermediate palette data.
2023-11-17 13:28:41 +09:00
Hermet Park
314c0a0351
saver/gif: code refactoring
...
Revised the code to keep the thorvg convention consistency.
2023-11-17 13:28:41 +09:00
Hermet Park
d46176f830
gif: fixed a regresion bug by clear() change
...
by 66305f3e6d
2023-11-17 13:28:41 +09:00
Hermet Park
9752644220
gif: support transparent gif animation
...
if no background is set, gif will generate transparent version.
Issue: https://github.com/thorvg/thorvg/issues/1769
2023-11-15 23:51:33 +09:00
Hermet Park
3999762d3b
saver/gif: code refactoring
...
Remove unused dithering logics for reducing binary size.
This is not quite effective for vector images.
2023-11-15 23:51:33 +09:00
Hermet Park
6e6dd8a97e
gl_engine/renderer: skip sync if nothing should be done.
...
update by 66305f3e6d
2023-11-15 22:33:39 +09:00
Hermet Park
66305f3e6d
sw_engine: Clear buffer at the proper time.
...
Clear the buffer when canvas->clear() is called.
TODO: We need to add a color value parameter to clear it.
2023-11-15 21:12:24 +09:00
Hermet Park
2d2a8a7df8
tools/lottie2gif: support background color setting.
...
A white background will be set by default.
Usage:
$lottie2gif test.lottie -b ff0000 //red background color
2023-11-14 10:47:52 +09:00
Hermet Park
08252990a6
wasm: Set a GIF background color.
...
Use a white background by default.
2023-11-14 10:47:52 +09:00
Hermet Park
1fddcd3af2
examples/GifSaver: updated with a background usage
2023-11-14 10:47:52 +09:00
Hermet Park
561a6d8935
savers: provides a background setting.
...
Allow users to set a custom background with a saver.
API:
- Result Saver::background(std::unique_ptr<Paint> paint);
2023-11-14 10:47:52 +09:00
Hermet Park
0611e7088c
lottie/parser: ++ blending options
...
thorvg blending is quite buggy,
the feature needs a verification.
2023-11-13 13:53:50 +09:00
Hermet Park
86bdf30479
examples: show users the best practice usage.
2023-11-10 13:56:11 +09:00
Hermet Park
33a2ef0b2d
sw_engine: ++null safety
2023-11-10 12:12:39 +09:00
Hermet Park
b133b2a8ae
lottie/builder: Fix a broken animation
...
The animation couldn't be triggered on a single thread.
Regression bug introduced by 29b5bc372d
2023-11-10 09:45:13 +09:00
Hermet Park
29b5bc372d
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-09 21:41:35 +09:00
Hermet Park
84f683d087
renderer/loader: code refactoring
...
Move the raw image loading interface to the RawImageLoader.
it is only valid for this component.
2023-11-09 14:46:32 +09:00
Hermet Park
2082343463
doc: make it up missing parameter information.
2023-11-09 14:46:14 +09:00
Hermet Park
d1bae0b44c
capi: udpated the doc.
...
BETA_API -> Experimental API
2023-11-08 10:53:39 +09:00