Commit graph

2964 commits

Author SHA1 Message Date
Hermet Park
43a5bf2fce lottie: ++ scene composing optimization
retain resuable layer solid paint during animation.
2024-09-30 15:29:22 +09:00
Hermet Park
3adee7238c lottie: ++ scene composing optimization
retain reusable precomp clipper shapes during animation.
2024-09-30 15:29:22 +09:00
Sergii Liebodkin
f7728a8b7a 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-09-30 15:29:22 +09:00
Hermet Park
192135835f lottie: ++memory access stability
Internal matrix can be null.
This update prevents such cases by using a safer API.
2024-09-30 15:29:07 +09:00
Jinny You
0953d000c1 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-09-30 15:28:24 +09:00
Hermet Park
12d0504a23 common: replace the round() with nearbyint()
nearbyint() is 2x faster than round() in our local test.
2024-09-30 15:24:39 +09:00
Hermet Park
f4cd6b8d8c sw_engine: code refactoring.
just renamed internal name shorter.
2024-09-30 15:23:21 +09:00
Hermet Park
8e6e224284 sw_engine: ++rle optimization
Reduction memory copy by pushing span data into rle immediately.
2024-09-30 15:23:15 +09:00
Mira Grudzinska
8e78745e2e 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-09-30 15:23:08 +09:00
Hermet Park
ef75fbcbb9 math: ++missing exceptions 2024-09-30 15:22:59 +09:00
Mira Grudzinska
0dc8b8cde7 sw_engine: fix masked translucent rect 2024-09-30 15:22:52 +09:00
Hermet Park
4f58124754 common/math: code refactoring
- migrate tvgLine to tvgMath
- associate line functions with classes.
2024-09-30 15:22:46 +09:00
Hermet Park
c9d1df3957 common/math: code refactoring
Replaced the prefix "math" with "tvg" namespace.
2024-09-30 15:22:38 +09:00
Hermet Park
d3a900701f 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-09-30 15:21:27 +09:00
Sergii Liebodkin
aae722e7ba wg_engine: fix masking methods support
See Masking, InvMasking, LumaMasking, InvLumaMasking, MaskingMethods examples

sw/webgpu
2024-09-30 15:21:20 +09:00
Hermet Park
ff06885e2f renderer: ++optimization
skip locking if the thread number is 0.
2024-09-30 15:21:07 +09:00
Hermet Park
aff7f61819 lottie: code refactoring
- _draw() returns boolean whether merging shape is allowed or not.
- renamed some internal variables.
2024-09-30 15:20:54 +09:00
Mira Grudzinska
c64923336d 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-09-30 15:20:46 +09:00
Mira Grudzinska
3cf3045ba5 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-09-30 15:20:39 +09:00
Hermet Park
2a6a221b6c example: print non support webgpu msg properly. 2024-09-30 15:20:31 +09:00
RuiwenTang
3eb2e66fe0 gl_engine: fix aliasing in gradient rendering 2024-09-30 15:11:40 +09:00
Mira Grudzinska
5276663c45 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-09-30 15:11:34 +09:00
Hermet Park
1d7bf0d9a2 example: ++ DirectUpdate to cover more scenarios. 2024-09-30 15:11:16 +09:00
Hermet Park
d8a8f1a01f example: improved to print proper fail msgs. 2024-09-30 13:00:12 +09:00
RuiwenTang
b71ad8adff 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-09-30 12:59:32 +09:00
Hermet Park
9b2468ed5b 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-09-30 12:57:22 +09:00
Hermet Park
78ece5befd 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-09-30 12:57:14 +09:00
Hermet Park
69d1d8dcd5 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-09-30 12:57:08 +09:00
JunsuChoi
3971094377 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-09-30 12:56:57 +09:00
Hermet Park
b00c55169e wg_engine: code refactoring
- apply thorvg compact coding style.
- separate private / public methods designated in sectors.
2024-09-30 12:56:51 +09:00
Sergii Liebodkin
a49a15af75 wg_engine: fix dispose render data in MT environment
Store desposed object in MT-safe list and then despose objects in sync stage
2024-09-30 12:56:45 +09:00
Hermet Park
4345d6b8a5 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-09-30 12:55:16 +09:00
Hermet Park
bc8effa836 gl_engine: --deprecated warnings on macOS
macOS has officially deprecated OpenGL.
shutdown the warnings to avoid be side-tracked.
2024-09-30 12:53:24 +09:00
RuiwenTang
4a1a586be9 gl_engine: fix memory leak when rendering image 2024-09-30 12:53:16 +09:00
Hermet Park
3dcc22309d gl_engine/renderer: code clean up
separate private / public methods designated in sectors.

no logical changes.
2024-09-30 12:53:08 +09:00
Hermet Park
f22afaefc2 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-09-30 12:52:38 +09:00
Sergii Liebodkin
9b638ea470 examples: fix surface refresh approuchfor webgpu
Move surface refresh approach from engine side to user size.
2024-09-30 12:51:09 +09:00
Sergii Liebodkin
e27ce23d4b 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-09-30 12:51:02 +09:00
RuiwenTang
35d168db9e gl_engine: support simple hairline stroke rendering
Reduce alpha if stroke width is too thin to mock hairline rendering
2024-09-30 12:50:43 +09:00
RuiwenTang
338c75ca3a 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-09-30 12:50:17 +09:00
Hermet Park
ce50165103 common: Fix a compilation failure on VS 2017
issue: https://github.com/thorvg/thorvg/issues/2512
2024-09-30 12:49:06 +09:00
Sergii Liebodkin
21286f679d wg_engine: fix scene opacity usage
Changed blend equation to make it the same as for referenced sw renderer.
2024-09-30 12:48:58 +09:00
Hermet Park
359ad22b3a 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-09-30 12:48:50 +09:00
Hermet Park
dd0705eef9 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-09-30 12:48:08 +09:00
Hermet Park
3390ff21fc sw_engine: support the grayscale scaled-image drawing 2024-09-30 12:46:56 +09:00
Hermet Park
98e613e3f0 lottie/parser: optimization++
Skip the data constructuion if the mask mode
is none. it's not used at all.
2024-09-30 12:46:49 +09:00
Hermet Park
b94c30675c 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-09-30 12:46:40 +09:00
Josh Soref
bb33a84a30 infra/workflow: Use GitHub Step Summary
Unlike comments, Step Summaries do not require permissions.
2024-09-30 12:46:32 +09:00
Josh Soref
2fa723c947 infra/workflow: Reduce workflow permissions
By explicitly listing the permissions required in general, repositories
without restrictive permissions will only allocate the specified
permissions which is much safer than the default, fairly wide,
permissions grant.

Most workflows don't appear to need any permissions beyond
`contents: read` which is required for checkout (when a repository is
private). By specifying this permission, it tells GitHub not to include
any of its additional default permissions (when a repository is
configured permissively).

The .github/workflows/memcheck_*.sh scripts called by build_ubuntu.yml
require write permissions in order to post their output to a pull
request (as a comment).

In locked down GitHub repositories, unless a workflow/job asks for
write permissions, it will not have them and such API calls will result
in:

{
  "message": "Resource not accessible by integration",
  "documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment",
  "status": "403"
}

By specifically requesting the permissions, the workflow will continue
to work as expected.
2024-09-30 12:46:24 +09:00
Josh Soref
dab9794e28 infra/workflow: Declare limited permissions for regression
Note that this workflow currently imagines writing a comment.
It does not actually try to do so, and thus there is no need to ask
for permission to use `pull-requests: write`.

If at some point, someone decides to fix that feature, they
will need to add that permission.

OTOH, using a GitHub Step Summary instead does not require any permissions.
2024-09-30 12:45:55 +09:00