Commit graph

2283 commits

Author SHA1 Message Date
Hermet Park
cd71c66703 loader/jpg: fix a sanitizer report.
Bypass the operation involving a negative value shift.

../src/loaders/jpg/tvgJpgd.cpp:434:36: runtime error: left shift of negative value -5
2023-08-21 17:16:45 +09:00
Mira Grudzinska
c2ca01a5c5 common: shape's composition fixed
In the case of a gradient stroke and a valid
fill, the composition wasn't applied correctly,
resulting in an unexpected overlap between
the fill and stroke.

@Issue: https://github.com/thorvg/thorvg/issues/445
2023-08-20 21:39:56 +09:00
Mira Grudzinska
70fff186b2 svg_loader: support other units for mask and clip
Added support for the objectBoundingBox value of
the clipPathUnits and for the userSpaceOnUse value
of the maskContentUnits.

@Issue: https://github.com/thorvg/thorvg/issues/429
2023-08-19 13:10:03 +09:00
Hermet Park
f573e1390f renderer/paint: added an option for stroking when acquiring bounding box size.
The 'Paint' function now includes an internal stroking option,
allowing the bounding box to be calculated with or without the stroke size taken into account.

This feature is particularly useful for SVG loaders,
and we might consider making the interface available for user demands in the future.
2023-08-18 22:15:55 +09:00
Hermet Park
2777d3ed17 doc: updated lottie demo video. 2023-08-18 18:29:18 +09:00
Hermet Park
e3e26abb45
Update README.md 2023-08-18 17:45:48 +09:00
Hermet Park
7e15cfaf15 doc: updated the lottie example video 2023-08-18 17:28:41 +09:00
Hermet Park
664f028c15 loader/lottie: fix all data conversion compiler warnings on windows 2023-08-18 16:36:15 +09:00
Hermet Park
c90962a26c lottie/loader: fix memory leaks 2023-08-18 15:16:34 +09:00
Hermet Park
cf826bee5d lottie/builder: --compiler warning on MacOS 2023-08-18 13:14:06 +09:00
Hermet Park
994c1b99a5 lottie/loader: support the masking features.
Enhancing the basic masking options by providing additional support.
2023-08-17 23:03:37 +09:00
Hermet Park
3b2c040f70 loader/lottie: add the missing solid color layer. 2023-08-17 23:03:37 +09:00
Hermet Park
3f05489b80 infra wasm: update the build script.
Disable the log in default for outside users.
we gonna turn it on manually for the lottie viewer
2023-08-17 23:03:37 +09:00
Hermet Park
e7d29e166b loaders: unify duplicated b64 decoders.
- move the svg/lottie b64 decoders to tvgLzw.
- renames tvgLzw -> tvgCompressor
2023-08-17 21:28:58 +09:00
Hermet Park
846823bd7f utils/math: binary size reduction
reduced the binary size by 2kb by removing the inline code.
2023-08-17 21:28:58 +09:00
Hermet Park
e4b8f70f4f loader/svg: remove the redundant copyright.
The SVG scene builder has undergone significant changes.
It no longer retains the shadow of the original source.
2023-08-17 21:28:58 +09:00
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