Commit graph

2381 commits

Author SHA1 Message Date
Jinny You
28ba5fe1b8 wasm: Update emscripten build config
enabled options:
- EXPORT_ES6 > to import glue code in es6 module system
- SINGLE_FILE > to build library as a single JS file, single file reduces loading latency
- MODULARIZE > proper option to build es6 module (optimized)
- EXPORTED_RUNTIME_METHODS > allow es6 module based glue code to import FS
2023-12-20 15:45:14 +09:00
Jinny You
99a841b404 wasm: Revise the wasm binding for lottie-player
- removed and replaced `tvgWasm`
2023-12-20 15:45:14 +09:00
Sergii Liebodkin
93f0e493ac wg_engine: refactor context handles
New approach provide:
- instance, adaptor, device and default queue
- device capabilitieas
- command buffer executor
- error handling
2023-12-20 10:43:18 +09:00
Sergii Liebodkin
1a6571f596 wg_engine: refactor render targets handling
For further development of features, we need to create off-screen buffers that will allow us to implement functionality related to composition and blending, as well as for loading data to system memory from the framebuffer. Separating the framebuffer into a separate entity allows you to create several instances of them, switch between them, and blend them according to given rules.

For current time we have only a single render target instance, that have a handle to drawing into surface surface, like a native window.

New approach allows:
- offscreen rendering
- render pass handling
- switching between render targets
- ability to render images, strokes and shapes into independent render targets
2023-12-20 01:33:23 +09:00
RuiwenTang
51a69880fd gl_engine: fix wrong scissor value cause content not fully rendered 2023-12-19 22:35:47 +09:00
Hermet Park
0552820c87 renderer: minor optimization.
reduce the binary size.
2023-12-19 13:02:09 +09:00
RuiwenTang
53b0b87bb7 gl_engine: optimize framebuffer creation and save some runtime memory
since the framebuffer will draw back to parent RenderPass, it can be
reused in next compose rendering.

So instead of create framebuffer every time when beginCompose is called, we
trying to reuse the framebuffer created before in the same stack level
2023-12-19 01:59:16 +09:00
Hermet Park
cd2e343192 doc: polish up the doxygen.
- applied @retval for those const values.
- applied @return for return value description.
2023-12-18 23:39:46 +09:00
Hermet Park
9d06308207 wg_engine: apply tvg coding style. 2023-12-18 23:34:13 +09:00
Sergii Liebodkin
e2458570f8 wg_engine: pipelines and bind groups refactoring
- shader and system types synchronized
- pipelens and bind groups description separated
- pipelines description simplified
2023-12-18 22:45:13 +09:00
Hermet Park
6f78d80ae6 renderer/picture: fixed a regression
reverted a wrong change from the previous code refactoring
in 5643348472
2023-12-16 00:10:42 +09:00
Hermet Park
5643348472 common: clean up the code. 2023-12-14 15:59:38 +09:00
Hermet Park
1ba20b9dfa doc: added thorvg-gpt badge (link) 2023-12-14 12:31:18 +09:00
Hermet Park
50aaade560
Update CONTRIBUTING.md 2023-12-14 12:27:59 +09:00
Hermet Park
9d73a7b5a3 Update CODEOWNERS
* removed inactive member.
2023-12-14 12:25:45 +09:00
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
be922c5bf9
Create CODE_OF_CONDUCT.md 2023-12-09 08:46:29 +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
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