Commit graph

2267 commits

Author SHA1 Message Date
Hermet Park
381dfb06d4 renderer paint: tiny optimization
Skip the unnecessary assignment of the value when the initial values
come.
2023-08-17 21:28:58 +09:00
RuiwenTang
66e533deee gl_engine: Fix mistake in glbuffer id check
`GL_INVALID_VALUE` is generate during `glGenBuffers` and is checked by
calling `glGetError()` inside `GL_CHECK` macro.

While the buffer id is valid if the value is not zero.
2023-08-17 21:28:37 +09:00
Mira Grudzinska
5bafdcbfa3 lottie_loader: return false for frameRate = 0
Loading a png file without giving a mimetype, resulted
in an error from the lottie loader.
2023-08-17 18:47:51 +09:00
Hermet Park
15c09f260f loader/lottie: Fix the incorrect precomp layer frame time
The frame number of the referenced layer should be
reduced by the precomp start frame.
2023-08-17 15:53:12 +09:00
Hermet Park
c5c40885ca
Update README.md
polishing up.
2023-08-17 11:08:18 +09:00
Hermet Park
9ec6ef7650
Update README.md 2023-08-16 16:48:47 +09:00
Mira Grudzinska
b9c71b4e0f common: log msg++ 2023-08-16 00:36:42 +09:00
Hermet Park
5778bda4db loader/lottie: do not build layers if the frame is out. 2023-08-15 15:49:10 +09:00
Hermet Park
86aabb4df0 loader lottie: image optimization
In every frame, the image undergoes a Colorspace conversion attempt.

This approach aims to bypass the step by retaining the pre-converted image data.

I acknowledge that this might not be the best approach,
but it is proving to be quite effective at the moment.
2023-08-15 15:49:05 +09:00
Hermet Park
765b02b49d renderer/transform: removing unnecessary initialization logic
The matrix initialization logic described here does not occur frequently.
It does not warrant investing extra time in comparing the transform values.
2023-08-15 15:48:59 +09:00
Hermet Park
df43f91644 loader/lottie: optimize the header task.
To achieve full threading efficiency,
the header should return the necessary properties:
view size, framerate, and duration.

This commit adds duration parsing.

Also don't do the header task in case of single thread
because there wouldn't be parallel effects.
2023-08-15 15:48:53 +09:00
Hermet Park
9e0a3aa678 loader lottie: tiny data copy optimization.
This patch tries to skip the matrix data copy as possible.
2023-08-15 15:48:48 +09:00
RuiwenTang
8212d6f0f9 gl_engine: refactor matrix calculation
1. convert mat4 directly from exist mat3, and remove unused calculation
   code.
2. since normalized position is only meaningful in vertex shader stage.
   use logical position in fragment shader stage for all gradient
   pipeline.
2023-08-14 23:59:26 +09:00
Mira Grudzinska
b5aa6e42be svg_loader: clips with multiple transf shapes/use nodes
Up until now, loading a clip composed of multiple
shapes worked correctly provided that they did not
undergo separate transformations. Now, such a case
has been handled.
Also the 'use' node inside the clip is supported.
2023-08-11 23:16:46 +09:00
RuiwenTang
acd51a3aa0 gl_engine: use modern glsl syntax in shader source
Upgrade the used glsl version in GL shader source.

  New version can directly specify the attribute location in
  shader and the uniform block is only available in new glsl version
2023-08-11 23:14:21 +09:00
Hermet Park
80ce345660 loader\lottie: Fixed incorrect b64 decoding
Image padding size should be increased by 1 for '\0'."
2023-08-11 22:57:16 +09:00
Hermet Park
3601d3db3a loader/png: revert force colorspace conversion.
We have a base color space conversion in the renderer,
so there's no need to forcefully align with BGRA.
2023-08-11 22:57:08 +09:00
Hermet Park
7057dc594d renderer: enhance stability
introduce a paint reference count
to prevent any duplicated resource removal.
2023-08-11 15:00:09 +09:00
Hermet Park
6a59e1b715 loader: avoid attempting forceful loading when the given MIME type is not correct.
Loading images when the MIME type is incorrect is unnecessary
and often results in failure, adding unnecessary processing overhead.

Pictures should have a clear MIME type assigned by users.
2023-08-11 15:00:09 +09:00
Hermet Park
374a125280 loader/lottie: enhance stability
Addressed corner cases to prevent memory violations.
2023-08-11 15:00:09 +09:00
Hermet Park
03976b02b3 infra/build: enable the lottie feature by default.
Lottie animation is a powerful feature in vector ux,
We can make this one of mandatory guidelines.
2023-08-11 15:00:09 +09:00
Hermet Park
1b020f70c4 loader lottie: support for stroke dash style
However, dash offset is still missing.
The TVG canvas needs to add the stroke offset feature.
2023-08-11 11:41:28 +09:00
RuiwenTang
9960cc4794 gl_engine: use vertex array buffer and index buffer when render primitive
VAO is new object in modern GL API, which can split and manage vertex
buffer and attribute state. This is optional in GLES and is mandatory in
GL.

Also index buffer is faster then pass cpu data in GL draw call.
2023-08-11 11:39:54 +09:00
RuiwenTang
7a35ff4d4b gl_engine: upgrade min gl version
most device supported morden gl which is:
GLES 3.0 for mobile GPU
GL 3.3 for desktop GPU
2023-08-09 23:23:57 +09:00
Hermet Park
345ef54e26 loader/lottie: add the rounded corner feature
The rounded rectangle property should be propagated to the root
through the lottie model scene-tree.
2023-08-09 21:30:25 +09:00
Hermet Park
8f4f3d6f1b loader/lottie: Add radial gradient support
This allows for the creation of basic radial gradients,
without support for focal points.
2023-08-09 21:30:25 +09:00
Hermet Park
d7c70c5371 loader/lottie: fix a missing layer timeremap.
The frame count should have been multiplied with the timeStretch property.
also newly implemented the TimeRemap(tm) property
2023-08-09 21:30:25 +09:00
Hermet Park
6f8504d3b9 loader/lottie: ++safety
- add an execeptional hanlding at parsing the assets.
- The precomp layer failed to prepare its instance in the parsing stage. This corrects the mistake.
2023-08-09 21:30:25 +09:00
RuiwenTang
9db9e003ba common: add new method to get mat4x4 directly from mat3x3
The 3x3 matrix already contains the geometric transformation
information required for 2D rendering.

We can directly convert from the 3x3 matrix to
the 4x4 matrix to facilitate subsequent GPU rendering.
2023-08-09 11:09:41 +09:00
RuiwenTang
0d4f45014a utils: add sort method in tvgArray
Add a new method in tvg::Array to support sort with custom comparer
2023-08-09 11:08:11 +09:00
Hermet Park
1e2051ded3
examples lottie: add an image test sample 2023-08-08 23:52:30 +09:00
Hermet Park
10cb09dbda examples/lottie: updated for wider coverage. 2023-08-08 23:47:58 +09:00
Hermet Park
f757eb6a71 loader/lottie: Support image property
This change makes it possible to use Lottie animations
that contain images from embedded/external resources.
2023-08-08 23:47:58 +09:00
Hermet Park
f31076a67e utils/str: Supplements functions.
Added strDirname(), which returns the directory path name from the given string.
Added str2int(), which converts from the string to the integer.

These functions are used to supplement the existing string manipulation functions in the utils/str module.
2023-08-08 23:47:58 +09:00
Hermet Park
cf1cb04752
Update README.md 2023-08-08 23:41:31 +09:00
Hermet Park
be8cfd5f3f common picture: --code inlining.
dec: 273029 -> 272789
2023-08-08 10:47:43 +09:00
Hermet Park
c0cb8c0ce8 apis: remove a beta api.
- const uint32_t* Picture::data(uint32_t* w, uint32_t* h) const

Returning pixel data is not guaranteed as the picture may contain vector resources.
Remove it unless it's absolutely necessary.

@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-08-08 10:47:37 +09:00
Hermet Park
9af89f9f18 common: deleted paints only when they are no longer valid.
Pictures can be shared with Animation instances.
The condition can now be distinguished by checking the `dispose()` return value.
2023-08-07 14:03:42 +09:00
Hermet Park
c97c60b900 binding wasm: fix a memory leak.
clear the buffer memory properly when a canvas size is changed.
2023-08-07 13:22:13 +09:00
Hermet Park
da1b036e4f loader lottie: -- beta tag.
Now, it's quite workable. Include it in our default integration test suite.
2023-08-07 10:56:35 +09:00
Hermet Park
4c5f858aa1 utils: code clean up
removed unnecessary declares.
2023-08-07 01:34:41 +09:00
Hermet Park
42251ecbe7
Update CONTRIBUTING.md 2023-08-06 12:31:10 +09:00
Hermet Park
0f18e9026b utils str: remove unnecessary definitions.
the compiler would remove the code if nowhere uses the internal functions.
2023-08-05 12:06:34 +09:00
Mira Grudzinska
f0d8ab4274 utils: math functions moved from lib to utils 2023-08-05 11:49:36 +09:00
Mira Grudzinska
6ad4a0b180 lottie_loader: custom strtof and strndup used
The custom version of 'strtof' must be used
because its result is dependent on the current
locale, which is't set in the project.
2023-08-05 11:49:36 +09:00
Mira Grudzinska
480917651a utils: custom strtof and strndup moved into utils
The custom implementations of 'strtof' and 'strndup'
present in the svg loader have been moved into a new
'utils' directory (strToFloat and strDuplicate, respectively).
2023-08-05 11:49:36 +09:00
Mira Grudzinska
07c05b52dc svg_loader: removed unused code
The custom strtof function is defined
in tvgSvgUtil.
2023-08-05 11:49:36 +09:00
Hermet Park
052cfea4b1 binding wasm: tag it as beta version.
wasm interfaces are fragile now.
we dont'guarantee compatibility yet.
2023-08-04 15:09:28 +09:00
Hermet Park
496ec72f2a binding wasm: support the animation. 2023-08-04 15:09:28 +09:00
Hermet Park
cee59dcd0e binding wasm: revise the code.
rewrite the code following the thorvg convention.
2023-08-04 15:09:28 +09:00