Commit graph

2943 commits

Author SHA1 Message Date
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
Mira Grudzinska
b66543f13d common: fix bezAngleAt function
In the function calculating the tangent to a cubic bezier
at a given t, the atan was calculated using dx over dy,
instead of dy over dx. The error was visible during
the animation using auto-orient = true.
2024-07-12 11:18:56 +09:00
RuiwenTang
90399665e2 gl_engine: fix aliasing in gradient rendering 2024-07-12 11:18:56 +09:00
Mira Grudzinska
c657e53f48 lottie: add support for image size
The width and height of the image must
be specified in the Lottie file and must
be taken into account during rendering.
2024-07-12 11:18:56 +09:00
RuiwenTang
b34fa36edb gl_engine: make sure solid color not overwrite gradient fill
If there are both gradient colors and solid colors
the gradient color is used first for rendering
2024-07-12 11:18:53 +09:00
Hermet Park
42e008f69c renderer: rectified render update flags.
Image update flag has been missed, when the image
is copied with a surface. This fixed it.

Also try to skip update if any properties were not changed.
2024-07-12 11:01:12 +09:00
Hermet Park
e12a244b9e renderer: Rectified the paint transforms.
This corrects the return value to Result::InsufficientCondition
when a custom transform is applied.

Additionally, unnecessary x and y member fields have been removed.
2024-07-12 11:01:01 +09:00
Hermet Park
4bd42ec7b1 lottie: ++thread safety.
comp pointer is used for checking if the header is ready.
It can be written in a worker thread and needs a critical
section on the reader side.

This also potentally improve the thread efficiency
from the segment() / marker() function calls.
2024-07-12 11:00:46 +09:00
JunsuChoi
c922eb9d2d svg_loader: Fix incorrect stack.pop() call in loader
loader->stack.pop() at line 3271 is called to remove
the defs node added to the stack due to nested graphics elements.
However, it is called in an inappropriate situation and the loader's node tree is damaged.
Fixes an error where the close tag is recognized as a `line` of the graphics tag when it is `linearGradient`.
ex)
```
    <defs id="def">
        <linearGradient x1="1" y1="2" x2="3" y2="4" id="l"/>
        </linearGradient>
        <rect x="10" y="10" width="10" height="10"  fill="blue" id="r2"/>
    </defs>
```

related issue: https://github.com/thorvg/thorvg/issues/2518
2024-07-12 11:00:38 +09:00
Hermet Park
d6cdae6237 example: corrected a wrong clear call. 2024-07-12 00:58:44 +09:00
Hermet Park
70b2f2dad1 bump up version v0.14.1 2024-07-05 12:19:34 +09:00
Hermet Park
f080976101 gl_engine: --deprecated warnings on macOS
macOS has officially deprecated OpenGL.
shutdown the warnings to avoid be side-tracked.
2024-07-05 12:19:34 +09:00
RuiwenTang
619a352cb2 gl_engine: fix memory leak when rendering image 2024-07-05 12:19:34 +09:00
Hermet Park
a3c5b0ec2f gl_engine: ++thread safety
The `dispose()` method can be called on a worker thread.
GL resources are released on `sync()`, ensuring guaranteed thread safety.
2024-07-05 11:04:28 +09:00
RuiwenTang
45c0e532fb gl_engine: support simple hairline stroke rendering
Reduce alpha if stroke width is too thin to mock hairline rendering
2024-07-05 11:02:44 +09:00
RuiwenTang
bfc09be82a gl_engine: optimize off-screen rendering
Performing a full-screen RenderPass resolve is too expensive.
Because most composite cases only require a small area to be rendered off-screen.
To improve performance, use the bounds of the Geometry for off-screen rendering whenever possible
2024-07-05 11:02:32 +09:00
Hermet Park
a328343dc7 common: Fix a compilation failure on VS 2017
issue: https://github.com/thorvg/thorvg/issues/2512
2024-07-05 10:58:04 +09:00
Hermet Park
64a0b84d71 lottie: fix a regression bug of masking
InverseAlphaMasking should be applied as intended,
but it was mistakenly reverted to alpha.

regression in v0.14.0 by: 2c7a83406e
2024-07-05 10:57:56 +09:00
Hermet Park
938d775ae5 lottie: allow image asset sharing among LottiePicture instances
Previously, the Lottie builder didn't account for image asset sharing
among multiple layers. This update rectifies the situation.

issue: https://github.com/thorvg/thorvg/issues/2428
2024-07-05 10:57:09 +09:00
Hermet Park
6071d3f933 sw_engine: support the grayscale scaled-image drawing 2024-07-05 10:56:02 +09:00
Hermet Park
b8b2478572 lottie/parser: optimization++
Skip the data constructuion if the mask mode
is none. it's not used at all.
2024-07-05 10:55:56 +09:00
Hermet Park
e4cbee61c8 lottie/builder: revise the masking update.
Append the mask shape to the previous one, instead of composition,
when it's able by the condition.

issue: https://github.com/thorvg/thorvg/issues/2426
2024-07-05 10:55:48 +09:00
Mira Grudzinska
b1618fe92a sw_engine: fix aa
For shapes with a stroke that has opacity, anti-aliasing
should be applied to a fill.
The use of a transparent gradient stroke will also be handled
correctly.
2024-07-05 10:55:37 +09:00
Hermet Park
7299295f05 api: ++description
issue: https://github.com/thorvg/thorvg/issues/2494
2024-07-05 10:55:26 +09:00
Hermet Park
10d96b32a0 lottie: remove exception handling
don't stop the parsing when the data type is incorrect.
just let it slide.

issue: https://github.com/thorvg/thorvg/issues/2389
2024-07-05 10:54:54 +09:00
Hermet Park
0874116742 lottie/rapidjson: --assert
Save binary size about 0.8kb
2024-07-05 10:54:46 +09:00
Mira Grudzinska
172429ea7c sw_engine: improve grad quality
For gradients with fill spread set as repeat,
the lack of anti-aliasing between the last and
the first color caused noticeable jagged edges.
Interpolation was introduced between them,
visually improving the gradient quality.
2024-07-05 10:54:29 +09:00
Vincent Torri
98eb16a61e json loader: fix warnings in jerryscript on Windows 2024-07-05 10:54:21 +09:00
Thaddeus Crews
97aa39d7cf common: ensure const equality operators
A minor syntactic adjustment to two instances of operator== and one instance of operator!=, both to the end of ensuring these locally-scoped functions are properly identified as const. In the majority of cases, this shouldn't have any impact; however, this change makes these operators play nice in c++20 contexts.
2024-07-05 10:54:12 +09:00
Hermet Park
ae4e9d003c bump up version v0.14.0 2024-06-27 14:44:39 +09:00
Hermet Park
a51c067894 test/capi: --compiler warning on MSVC
warning C4305: 'argument': truncation from 'double' to 'float'
2024-06-27 14:44:39 +09:00
Hermet Park
5f4468236c sw_engine: ++thread safety
Synchronize the engine process precisely
before updating internal data.
2024-06-27 14:42:27 +09:00
Hermet Park
6f0ae1cd3f example: do not scan a given resource folder recursively 2024-06-27 14:42:27 +09:00
Mira Grudzinska
66048b31b5 wg_engine: fix shapes closing
Shapes were incorrectly closed in certain cases -
the decision to close a shape or not should be based on
path commands rather than the number of points and
their distances from each other.
2024-06-27 14:42:27 +09:00
Hermet Park
38e2812004 renderer: ++stabilization
This introduces a managed condition to precisely control the
canvas updates. This prevents a crash when the target is
changed and drawn without any update calls.

issue: https://github.com/thorvg/thorvg/issues/2484
2024-06-27 14:42:27 +09:00
Hermet Park
3019bb81e8 example: do not redraw for the static content 2024-06-27 14:42:27 +09:00
Hermet Park
8c11fa085f example: ++exception handling 2024-06-27 14:42:27 +09:00
Mira Grudzinska
0f2fe0c4d4 common: fix rendering failure
In case of a problem with loading font data, there
is no paint inside a text that can be rendered,
but this should not interrupt the rendering process
of other paints. Now fixed.

@Issue: https://github.com/thorvg/thorvg/issues/2468
2024-06-27 14:42:27 +09:00