Commit graph

2360 commits

Author SHA1 Message Date
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
Hermet Park
20fdcb4ccd docs: updated 2023-12-08 10:07:47 +09:00
Hermet Park
819ccfaf91 docs: updated resource image. 2023-12-08 10:03:55 +09:00
Jinny You
914144bb5a lottie/builder: fix crash by null reference 2023-12-07 17:52:40 +09:00
Hermet Park
32cd145cf1
Update README.md 2023-12-07 13:19:57 +09:00
Hermet Park
52af07b69e
Update README.md 2023-12-07 13:18:53 +09:00
Hermet Park
b9d20a659b
Update README.md 2023-12-06 23:34:19 +09:00
Hermet Park
660bb830af doc: updated practices 2023-12-06 23:30:57 +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
6f2bd5801c
Update README.md 2023-11-23 19:08:58 +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
bd3d01d222
Update CODEOWNERS 2023-11-23 18:17:41 +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
ba2a2f02cf
Update CONTRIBUTING.md 2023-11-22 01:01:50 +09:00
Hermet Park
75ccf1f527
Update CONTRIBUTING.md 2023-11-22 01:00:11 +09:00
Hermet Park
1216241fca
Update CODEOWNERS
Welcome a new committer, SergeyLededkin
2023-11-22 00:58:16 +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
28b26796c8
Update README.md
updated sample code
2023-11-20 13:43:20 +09:00
Hermet Park
1a4d533ce1
Update README.md
updated thorvg viewer video
2023-11-18 00:17:09 +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
Hermet Park
ab35ab2171 test: added gif save test
Skipped capi tests this time, since it has no saver api now.
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
cc868e2248 infra: fix git-action ios break 2023-11-16 15:37:30 +09:00
Hermet Park
4cf2cc6707
Update README.md 2023-11-15 23:58:31 +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
Jinny You
0c9827a9ed infra: fix macos build crash 2023-11-15 13:45:38 +09:00