Commit graph

2980 commits

Author SHA1 Message Date
Mira Grudzinska
1ef9c6be9b common: move&fix trimming wrapping logic
The logic of interpretation of trimming start and
end values has been moved to the sw_engine,
so the values provided by the user are not modified.
No logical changes in the interpretation alg.

For pairs of trim's start/end values where the distance
between begin and end is >= 1, the entire stroke should
be drawn, but instead, nothing or only part is drawn. Fixed.

Stroke trim docs fixed.
2024-08-09 11:33:38 +09:00
Hermet Park
a85f323425 lottie/expressions: feature enhancement
added groupIndex() support
added property (ix) value support
2024-08-09 11:33:38 +09:00
Hermet Park
a70c211409 lottie: code refactoring
Access its type from a property instance,
through coherent data structure.
2024-08-09 11:33:38 +09:00
Łukasz Pomietło
045b30b94f ttf_loader: Basic support for composite glyphs loading (#2600)
Adds the ability to load some composite glyphs and prevents an error when a composite glyph is used.

Implementation based on ttf glyf table documentation: https://learn.microsoft.com/en-us/typography/opentype/spec/glyf

There are still some missing features like scaling, parent glyph point based positioning etc. I think this is a topic for future work. Howerever, it looks like implemented features are enough for utf-8 latin subset in major fonts.

issue: #2599
2024-08-09 11:33:33 +09:00
Hermet Park
8c4b9b2772 renderer: code refactoring
Replaced the transformation with
a strong associated data field.

This helps to reduce the binary size (-1k).
2024-08-09 10:49:26 +09:00
Hermet Park
0c709b2e43 common: code refactoring
Trimming the transform data pass,
from RenderTransform to Matrix.

No logical changes.
2024-08-09 10:37:39 +09:00
Mira Grudzinska
273fe5b46d sw_engine: fix radial coefficients calculations
In the Taylor series expansion, there was a missing
division by 2! in the term with the second derivative.

@Issue: https://github.com/thorvg/thorvg/issues/2530
2024-08-09 10:29:53 +09:00
Hermet Park
3fb017c2fb examples/text: hotfix
corrected wrong arguments.
2024-08-08 12:37:10 +09:00
Hermet Park
ece447895a bump up version v0.14.4 2024-07-26 13:05:37 +09:00
Hermet Park
84475df8ab lottie/expressions: hotfix
- fixed a memory leak.
- corrected loopIn key value.
2024-07-26 13:05:37 +09:00
Hermet Park
267a467dab sw_engine: rectified the image raster return value.
Return the raster image as a success unless
it fails due to any problematic condition.

The changed cases are just invisible condition
of the images.
2024-07-26 12:13:37 +09:00
Hermet Park
57e0d5b448 renderer/animation: rectified the segment value exception
A zero-range segment can be useful for a stopped motion.
There is no need to prohibit these values.
2024-07-26 11:37:16 +09:00
Hermet Park
b95ddd3112 lottie/expressions: feature support enhancement
- revised the transformation building logic.
- rectified to properly search "this" composition layers.
- rectified the linear interpolation implementation.
- added "pingpong" looping attributes.
2024-07-26 11:37:16 +09:00
Hermet Park
6d97172227 lottie: code refactoring
- removed unnecessary variables.
- migrated the composition methods to the precomp layer.
2024-07-26 11:37:16 +09:00
Mira Grudzinska
641fe5b544 sw_engine: fix linear grad issue
The restriction of the 'length' of a linear gradient
to values greater than FLT_EPSILON was causing rendering
issues in cases where it was a valid gradient with well
defined dx and dy values.

@Issue: https://github.com/thorvg/thorvg/issues/2582
2024-07-26 11:37:16 +09:00
Hermet Park
771b401f90 svg: resolve compiler warnings.
../src/loaders/svg/tvgSvgLoader.cpp: In function ‘bool _toColor(const char*, uint8_t*, uint8_t*, uint8_t*, char**)’:
../src/loaders/svg/tvgSvgLoader.cpp:108:17: warning: ‘hue’ may be used uninitialized [-Wmaybe-uninitialized]
  108 |     const char* _end = end ? *end : nullptr;
      |                 ^~~~
../src/loaders/svg/tvgSvgLoader.cpp:713:31: note: ‘hue’ was declared here
  713 |         const char *content, *hue, *saturation, *brightness;
      |                               ^~~
../src/loaders/svg/tvgSvgLoader.cpp:108:17: warning: ‘saturation’ may be used uninitialized [-Wmaybe-uninitialized]
  108 |     const char* _end = end ? *end : nullptr;
      |                 ^~~~
../src/loaders/svg/tvgSvgLoader.cpp:713:37: note: ‘saturation’ was declared here
  713 |         const char *content, *hue, *saturation, *brightness;
      |                                     ^~~~~~~~~~
../src/loaders/svg/tvgSvgLoader.cpp:108:17: warning: ‘brightness’ may be used uninitialized [-Wmaybe-uninitialized]
  108 |     const char* _end = end ? *end : nullptr;
      |                 ^~~~
../src/loaders/svg/tvgSvgLoader.cpp:713:50: note: ‘brightness’ was declared here
  713 |         const char *content, *hue, *saturation, *brightness;
      |                                                  ^~~~~~~~~~
2024-07-26 11:37:16 +09:00
Hermet Park
ac7177127a lottie: ++optimization with object culling
More precisely, culling the render objects by
determining if the group has no renderable objects.

Additionally, check opacity to quickly return
in the rendering process.
2024-07-26 11:37:16 +09:00
Hermet Park
859cac20dd lottie: hotfix with an intermediate patch merge. 2024-07-26 11:37:16 +09:00
Hermet Park
ecec838006 lottie: ++scene rendering optimization
Apply LottieRenderPooler to texts.
2024-07-26 11:37:16 +09:00
Hermet Park
4a447abaae renderer: quick skip rendering if the opacity is zero
This also resolves a corner case bug introduced by
lottie render pooling: f06127ab93
2024-07-26 11:37:16 +09:00
Hermet Park
bd0a7725e0 lottie/expressions: ++coverage enhancement
Allow to access layer index globally.
2024-07-26 11:21:05 +09:00
Hermet Park
571a7f5293 bump up version: v0.14.3 2024-07-19 08:46:19 +09:00
Hermet Park
e0b2cc462b lottie/expressions: added a missing polystar property build. 2024-07-19 08:43:24 +09:00
Hermet Park
71a0010c2d sw_engine: ++alpha blending operation.
Reduce instructions, improving its performance by ~15%
2024-07-19 08:42:19 +09:00
Mira Grudzinska
00e5c87a79 capi: the version api binding 2024-07-19 08:42:09 +09:00
Mira Grudzinska
b876402311 common: version api introduced
@Issue: https://github.com/thorvg/thorvg/issues/2543
2024-07-19 08:42:02 +09:00
Hermet Park
183749d1aa renderer: ++null check
fixed a Duplicate example crash, regression by:
f06127ab93
2024-07-19 08:41:54 +09:00
Hermet Park
cf253dd873 lottie: ++scene rendering optimization
Apply LottieRenderPooler to path/rect/ellipse/polystar.

This enhances the animation performance: ~10%
2024-07-19 08:41:38 +09:00
Mira Grudzinska
d0210a1a72 sw_engine: grayscale image support++ 2024-07-19 08:40:06 +09:00
Hermet Park
1131695ce4 lottie: introduced LottieRenderPooler
LottieRenderPooler is designed to manages rendering
instances(paints) efficiently through a simple pooling
mechanism to resuse among the animations

This replaces the previous individusal paints implemenations
among solidfill, precomp vierport and pictures,
also fix a potential paints corruption problems.
2024-07-19 08:39:53 +09:00
Hermet Park
d13606e14b lottie/parser: tiny binary size reduction 2024-07-19 08:35:18 +09:00
Mira Grudzinska
917917de7a lottie: support 'direction' in ellipses 2024-07-19 08:35:08 +09:00
Mira Grudzinska
9ebc2045d6 lottie: remove unnecessary cast 2024-07-19 08:35:01 +09:00
Hermet Park
4f2f4dbf26 Revert "Revert "lottie: ++ scene composing optimization""
This reverts commit 8c3586a7c4.
2024-07-19 08:34:25 +09:00
Hermet Park
f6c4d8a94e bump up version: v0.14.2 2024-07-12 11:28:48 +09:00
Hermet Park
8c3586a7c4 Revert "lottie: ++ scene composing optimization"
This reverts commit bfdc8e4de7.

hotfix due to a memoy corruption. please see asan test.
2024-07-12 11:28:48 +09:00
Hermet Park
774d366dc2 lottie: clarify shape direction.
There are only two options clockwise or counter-clockwise.
2024-07-12 11:18:56 +09:00
Mira Grudzinska
39bc836eef lottie: apply direction to rect 2024-07-12 11:18:56 +09:00
Hermet Park
3336e85025 lottie: ++ scene composing optimization
retain resuable layer solid paint during animation.
2024-07-12 11:18:56 +09:00
Hermet Park
bfdc8e4de7 lottie: ++ scene composing optimization
retain reusable precomp clipper shapes during animation.
2024-07-12 11:18:56 +09:00
Hermet Park
e1871f79f8 lottie: ++memory access stability
Internal matrix can be null.
This update prevents such cases by using a safer API.
2024-07-12 11:18:56 +09:00
Jinny You
b24e876a67 lottie/text: Support text range selector (Phase 1)
This patch provides initial support for the text range selector. Full support will be added gradually in subsequent steps. This is the first step.

Text range selector with following properties:
1. Text Range Selector (Units)
2. Text Style
- Fill Color
- Fill Opacity
- Stroke Color
- Stroke Width
- Stroke Opacity
- Opacity
- Rotation
- Position
- Scale
2024-07-12 11:18:56 +09:00
Hermet Park
318c76119a common: replace the round() with nearbyint()
nearbyint() is 2x faster than round() in our local test.
2024-07-12 11:18:56 +09:00
Hermet Park
74f5928e84 sw_engine: ++rle optimization
Reduction memory copy by pushing span data into rle immediately.
2024-07-12 11:18:56 +09:00
Mira Grudzinska
29b06e0d9a lottie: improvement 3d rotation
For rotation around the X and Y axes, the transformation
matrix was incorrectly created - elements e12 and e21
were omitted. Now fixed.
2024-07-12 11:18:56 +09:00
Mira Grudzinska
8fceba01d2 sw_engine: fix masked translucent rect 2024-07-12 11:18:56 +09:00
Hermet Park
1c8698ce20 common/math: introduced custom atan2()
the custom atan2 algorithm by Remez.
see: https://en.wikipedia.org/wiki/Remez_algorithm

This improved the Lottie example by ~2ms.
Total atan2 performance time was reduced by 43%
2024-07-12 11:18:56 +09:00
Hermet Park
19815de7d7 renderer: ++optimization
skip locking if the thread number is 0.
2024-07-12 11:18:56 +09:00
Hermet Park
04dbc5f509 lottie: code refactoring
- _draw() returns boolean whether merging shape is allowed or not.
- renamed some internal variables.
2024-07-12 11:18:56 +09:00
Mira Grudzinska
0e0c25e873 lottie: enhance support for ao: 1
Adding support for auto-orient=true for frames <= first
and >= last, as well as for positions specified without
outer and inner tangent.
2024-07-12 11:18:56 +09:00