Commit graph

2989 commits

Author SHA1 Message Date
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
Josh Soref
0e48234cab infra/workflow: Only comment if there is output 2024-09-30 12:45:47 +09:00
Mira Grudzinska
ceae547062 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-09-30 12:45:40 +09:00
Hermet Park
7b79f37dd2 api: ++description
issue: https://github.com/thorvg/thorvg/issues/2494
2024-09-30 12:45:29 +09:00
Hermet Park
3d3c76083f updated AUTHORS 2024-09-30 12:45:22 +09:00
Hermet Park
74cd0ba0e7 common: code refactoring
replaced min/max with the standard library
2024-09-30 12:45:14 +09:00
Hermet Park
fad80deceb 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-09-30 12:42:17 +09:00
Hermet Park
dfa2b78ad8 lottie/rapidjson: --assert
Save binary size about 0.8kb
2024-09-30 12:42:10 +09:00
Josh Soref
e3c66db301 common: fix 178+ spelling errors 2024-09-30 12:41:38 +09:00
Mira Grudzinska
f3e0dc3432 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-09-30 12:37:15 +09:00
Vincent Torri
ab7ff34674 json loader: fix warnings in jerryscript on Windows 2024-09-30 12:37:03 +09:00
Thaddeus Crews
2f2435dd34 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-09-30 12:36:55 +09:00
Hermet Park
0ecd09e7ff doc: polishing++ 2024-09-30 12:36:43 +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
Mira Grudzinska
90ee76bd7b examples: fix sdl2 headers in Capi example 2024-06-27 14:42:27 +09:00
Hermet Park
89c31d0e35 docs: updated to v0.14 2024-06-27 14:42:27 +09:00
Hermet Park
f3469350b9 lottie: fix a data-race problem
make it sync call before accessing the composition data
from marker and segments.

issue: https://github.com/thorvg/thorvg/issues/2462
2024-06-27 14:42:27 +09:00
Hermet Park
dcf67e9c14 Revert "renderer/canvas: Check refresh before draw"
This reverts commit 60212747b5.

this triggered duplicated updates,
it came up with many thread sanitizer problems.

issue: https://github.com/thorvg/thorvg/issues/2462
2024-06-27 14:42:27 +09:00