Commit graph

2995 commits

Author SHA1 Message Date
Hermet Park
c20ecbcc58 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-13 19:22:06 +09:00
Hermet Park
bcc2f5008c infra: updated ios arm64 build 2024-07-13 15:30:20 +09:00
Hermet Park
b915455e89 examples: added LottieExpressions 2024-07-12 18:57:10 +09:00
Hermet Park
cfc8f13584 lottie/parser: tiny binary size reduction 2024-07-12 14:43:00 +09:00
Mira Grudzinska
8340c1e1d7 lottie: support 'direction' in ellipses 2024-07-12 14:23:27 +09:00
Mira Grudzinska
bedaa909ad lottie: remove unnecessary cast 2024-07-12 13:54:49 +09:00
Hermet Park
ad2b6f6d51 examples: updated lottie samples 2024-07-12 00:39:31 +09:00
Hermet Park
22bab117a3 lottie: clarify shape direction.
There are only two options clockwise or counter-clockwise.
2024-07-12 00:39:31 +09:00
Mira Grudzinska
6025635712 lottie: apply direction to rect 2024-07-12 00:05:08 +09:00
Hermet Park
a69a5c300f examples: added svg samples 2024-07-11 23:31:07 +09:00
Hermet Park
4cb327c9fd lottie: ++ scene composing optimization
retain resuable layer solid paint during animation.
2024-07-11 21:30:31 +09:00
Hermet Park
d95ec72335 lottie: ++ scene composing optimization
retain reusable precomp clipper shapes during animation.
2024-07-11 21:30:31 +09:00
Sergii Liebodkin
3223f17f9c wg_engine: Viewport support
[issues 1479: Viewport](#1479)

Supports viewport settings and rectangular clip path.
Scissors cliping used as a way to clip viewport
2024-07-11 21:24:18 +09:00
Hermet Park
d6d4839f1a lottie: ++memory access stability
Internal matrix can be null.
This update prevents such cases by using a safer API.
2024-07-11 01:03:50 +09:00
Jinny You
fdc1ad4d2c 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-11 00:49:57 +09:00
Hermet Park
5a2a6fc4a9 common: replace the round() with nearbyint()
nearbyint() is 2x faster than round() in our local test.
2024-07-10 23:43:10 +09:00
Hermet Park
837cf32bcb sw_engine: code refactoring.
just renamed internal name shorter.
2024-07-10 18:35:20 +09:00
Hermet Park
065a8f5eb3 sw_engine: ++rle optimization
Reduction memory copy by pushing span data into rle immediately.
2024-07-10 18:35:20 +09:00
Mira Grudzinska
e07ff127dd 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-10 16:58:03 +09:00
Hermet Park
ee29a000f2 math: ++missing exceptions 2024-07-10 03:53:09 +09:00
Mira Grudzinska
ebfdf2102e sw_engine: fix masked translucent rect 2024-07-10 00:34:23 +09:00
Hermet Park
69b1fb8208 common/math: code refactoring
- migrate tvgLine to tvgMath
- associate line functions with classes.
2024-07-10 00:21:02 +09:00
Hermet Park
44955b704e common/math: code refactoring
Replaced the prefix "math" with "tvg" namespace.
2024-07-10 00:21:02 +09:00
Hermet Park
79cf7ca5af 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-09 23:50:37 +09:00
Sergii Liebodkin
8c4102362f wg_engine: fix masking methods support
See Masking, InvMasking, LumaMasking, InvLumaMasking, MaskingMethods examples

sw/webgpu
2024-07-09 22:02:30 +09:00
Hermet Park
662dac075c renderer: ++optimization
skip locking if the thread number is 0.
2024-07-09 18:07:25 +09:00
Hermet Park
e0116b90c4 lottie: code refactoring
- _draw() returns boolean whether merging shape is allowed or not.
- renamed some internal variables.
2024-07-09 12:27:32 +09:00
Mira Grudzinska
49e58eecc0 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-09 12:27:21 +09:00
Mira Grudzinska
2309770409 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-09 12:19:21 +09:00
Hermet Park
61b68fab5b example: print non support webgpu msg properly. 2024-07-09 11:26:18 +09:00
RuiwenTang
8d6b1d6da3 gl_engine: fix aliasing in gradient rendering 2024-07-09 11:20:51 +09:00
Mira Grudzinska
423e37d4d5 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-08 21:20:34 +09:00
Hermet Park
329ab9ef4a example: ++ DirectUpdate to cover more scenarios. 2024-07-08 11:39:28 +09:00
Hermet Park
300ced90c1 example: improved to print proper fail msgs. 2024-07-08 11:39:28 +09:00
RuiwenTang
e7c9ec790c 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-08 11:33:43 +09:00
Hermet Park
9ecb296b99 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-08 00:03:28 +09:00
Hermet Park
eb86ac539c 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-07 21:43:30 +09:00
Hermet Park
8cbfb4b8bb 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-07 13:26:05 +09:00
JunsuChoi
6b6eac8f93 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-06 11:43:21 +09:00
Hermet Park
8be44e66d2 wg_engine: code refactoring
- apply thorvg compact coding style.
- separate private / public methods designated in sectors.
2024-07-06 11:37:57 +09:00
Sergii Liebodkin
1932107097 wg_engine: fix dispose render data in MT environment
Store desposed object in MT-safe list and then despose objects in sync stage
2024-07-06 11:22:30 +09:00
Hermet Park
889d1d1fa2 API: revise the APIs.
deprecate the `identifier()` APIs by replacing them with `type()`.

ThorVG is going to introduce an instance `id()`,
and this could be confused with the `identifier()` methods.

with this new type() method can reduce the memory size
by removing unncessary type data.

New Experimental C APIs:
- enum Tvg_Type
- Tvg_Result tvg_paint_get_type(const Tvg_Paint* paint, Tvg_Type* type)
- Tvg_Result tvg_gradient_get_type(const Tvg_Gradient* grad, Tvg_Type* type)

New Experimental C++ APIs:
- Type Paint::type() const
- Type Fill::type() const
- Type LinearGradient::type() const
- Type RadialGradient::type() const
- Type Shape::type() const
- Type Scene::type() const
- Type Picture::type() const
- Type Text::type() const

Deprecated C APIs:
- enum Tvg_Identifier
- Tvg_Result tvg_paint_get_identifier(const Tvg_Paint* paint, Tvg_Identifier* identifier)
- Tvg_Result tvg_gradient_get_identifier(const Tvg_Gradient* grad, Tvg_Identifier* identifier)

Deprecated C++ APIs:
- enum class Type
- uint32_t Paint::identifier() const
- uint32_t Fill::identifier() const
- static uint32_t Picture::identifier()
- static uint32_t Scene::identifier()
- static uint32_t Shape::identifier()
- static uint32_t LinearGradient:identifier()
- static uint32_T RadialGradient::identfier()

Removed Experimental APIs:
- static uint32_t Text::identifier()

issue: https://github.com/thorvg/thorvg/issues/1372
2024-07-05 21:25:58 +09:00
Hermet Park
d8f00f79be gl_engine: --deprecated warnings on macOS
macOS has officially deprecated OpenGL.
shutdown the warnings to avoid be side-tracked.
2024-07-05 12:17:39 +09:00
RuiwenTang
ea11d4d8a8 gl_engine: fix memory leak when rendering image 2024-07-05 12:13:53 +09:00
Hermet Park
4fee5458b2 gl_engine/renderer: code clean up
separate private / public methods designated in sectors.

no logical changes.
2024-07-05 10:46:47 +09:00
Hermet Park
688952be56 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 10:46:47 +09:00
Sergii Liebodkin
4693d7f4c1
examples: fix surface refresh approuchfor webgpu
Move surface refresh approach from engine side to user size.
2024-07-04 20:54:14 +09:00
Sergii Liebodkin
e7e6839571
wg_engine: fix blend methods support
Full review of blending support.
Support Solid color, Gradient fill and Image blending workflows

See Blending, SceneBlending, Opacity examples
2024-07-04 16:19:50 +09:00
RuiwenTang
9bed64a4e7 gl_engine: support simple hairline stroke rendering
Reduce alpha if stroke width is too thin to mock hairline rendering
2024-07-04 12:03:39 +09:00
RuiwenTang
76f98008e8 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-04 11:44:02 +09:00