Commit graph

2846 commits

Author SHA1 Message Date
EunSik Jeong
fa73bbd032 sw_engine/neon : Fix compilation error 2024-04-06 10:41:51 +09:00
Hermet Park
2ad441db29 Update README.md 2024-04-06 00:52:03 +09:00
Hermet Park
c8993e048c renderer/loader: fix a font loader memory leak 2024-04-05 16:51:22 +09:00
Hermet Park
b0f258d531 test: improve the test-coverage.
make the lottie/text coverage up.

issue: https://github.com/thorvg/thorvg/issues/2067
2024-04-05 16:51:22 +09:00
Sergii Liebodkin
392f59db9d wg_engine: vertex, index and unifroms buffers, render objects caching
[issues 1479: lottie](#1479)

Vertex, Index and uniform buffers now updates instead of recreate.
Implemented pools form mesh objects and render shapes data

it increase performance in 30-40% in massive animations scenes
2024-04-05 11:40:57 +09:00
Hermet Park
1efb72ce94 gl_engine: hotfix for the main surface drawing issue.
GL might need to generate a default target FBO
when the given target ID indicates the main surface.

However, users may want to draw visuals directly onto the main surface.

This policy must be reviewed thoroughly.
2024-04-05 01:11:14 +09:00
RuiwenTang
1e93eb0f49 gl_engine: change all shader output premultiplied alpha color 2024-04-05 01:11:00 +09:00
Hermet Park
d37ed535d1 wasm: update the gif conversion function
re-implement the gif conversion function with the correct approach.
The input data is not reusable as it undergoes modifications during parsing.

To address this, the function now creates a backup of the original data for use in GIF conversion.

This also resolves issues where the GIF viewport was incorrectly matched.

This implementation may be revisited upon
the availability of Animation::duplicate().
2024-04-05 01:10:39 +09:00
Hermet Park
059939f2ed wasm: optimize TVG saving Logic
Optimized the saving logic for TVG.

Copying the picture is unnecessary;
the logic now directly utilizes the currently held picture.
2024-04-05 01:10:39 +09:00
Hermet Park
06a34a4c65 renderer/loader: ensure unique scene instances for each Lottie loader
The Lottie loader now utilizes an individual scene instance per loader.
This guarantees that each instance retains a unique frame number,
essential for maintaining the integrity of animation states.

As a result, sharing loaders between Lottie animations is prohibited
to uphold frame context isolation.

This may be subject to optimization review in the future.
2024-04-05 01:10:39 +09:00
Hermet Park
1228f52dc9 renderer/saver: enhanced safety
enhanced safety by taking into account the object reference counting.
2024-04-05 01:10:39 +09:00
JunsuChoi
a4ced1963e loader/svg: Fix invalid syntax check
If the key is not parsed and the '=' keyword is located next,
modify it to parse the following syntax.

related issue:
https://github.com/thorvg/thorvg/issues/2116
2024-04-04 15:58:07 +09:00
Youjin Lee
ab49e2ee2b Modify txt file for cross-platform build setup
Following the Android developer guide (https://developer.android.com/ndk/guides/other_build_systems), added HOST_TAG to the directory.
2024-04-04 14:09:35 +09:00
Hermet Park
4b3b7f7823 Update CODEOWNERS
auto assign .github reviewers
2024-04-04 14:09:14 +09:00
Hermet Park
99a29ae97f lottie: removed unused code.
Currently, thorvg has no plan to support dotlottie format.
2024-04-04 14:09:04 +09:00
Sergii Liebodkin
b0280150db wg_engine: Blending optimization
[issues 1479: lottie](#1479)

To optimize bled operations hardware pipeline blend stage are used for some blend methods:
	BlendMethod::SrcOver
    BlendMethod::Normal
    BlendMethod::Add
    BlendMethod::Multiply
    BlendMethod::Darken
    BlendMethod::Lighten

Other types compute shaders used
2024-04-04 11:03:59 +09:00
Hermet Park
622b25a3b4 lottie: hotfix memory corruption.
revise the fix that occured a side effect by:
287e6d33d2
2024-04-03 18:27:01 +09:00
Hermet Park
a4a585d8f0 sw_engine/stroke: hotfix the memory access violation
ensure that the number of contour/close data is properly paired.

issue: https://github.com/thorvg/thorvg/issues/2129
2024-04-03 13:52:34 +09:00
Jinny You
287e6d33d2 lottie: Fix heap-buffer-overflow in gradient populate 2024-04-03 13:19:19 +09:00
JunsuChoi
79c65aa5e7 loader/svg: Check invalid color
Checks whether the string that can be specified in Color is valid.

example)
```
     style="stroke:asdasd"
```

related issue: https://github.com/thorvg/thorvg/issues/1255
2024-04-03 11:38:49 +09:00
Hermet Park
cbed261ba2 lottie: Properly handle the TrimPath mode.
This correction addresses the drawing order of
objects when a group contains a TrimPath and
is merging shapes.

Additionally, the TrimPath method is can applied
to the engine to control the drawing behavior by
7f3dc541d6b7abcdc03facd884489f37c327fd98

issue: https://github.com/thorvg/thorvg/issues/2047
2024-04-03 10:46:01 +09:00
Hermet Park
c74cd42363 sw_engine: revised the trimpath dash line logic
Support the TrimPath modes (individual/simultaneous)
internally in the engine to handle them efficiently.
2024-04-03 10:46:01 +09:00
Hermet Park
75477f502e
Update README.md 2024-04-03 01:15:52 +09:00
JunsuChoi
dea08681c0 loader/svg: Support hsl color format
Support parsing of hsl(hue, saturation, brightness) color type
and conversion to rgb color.
2024-04-02 22:59:13 +09:00
Sergii Liebodkin
712fc3cfea wg_engine: Lottie extensions
[issues 1479: LottieExtensions](#1479)

LottieExtensions example supports
Supports multiple color stops for gradient fill (redial and linear)
2024-04-02 20:06:06 +09:00
Jinny You
8bc1daac38 lottie: Fix buffer-overflow in base64 decode 2024-04-01 15:41:16 +09:00
Hermet Park
c503f688db sw_engine: hotfix a regression bug of line drawing.
fixed one more corner case problem, just observed.
it's a side effect by 925009c4a5
2024-04-01 10:52:44 +09:00
Hermet Park
e8e9ba5ea0 infra: move the examples folder outside of the source directory.
examples are not considered a feature of ThorVG;
hence, they are excluded from the src directory.

This change allows developers to concentrate more effectively
on the core ThorVG sources for practical usages.
2024-04-01 10:52:22 +09:00
Hermet Park
9cd71589d8
Update README.md 2024-03-30 14:19:53 +09:00
Vincent Torri
ac1681d07f README.MD: add instructions to install and update thorVG with MSYS2 2024-03-30 14:17:02 +09:00
Hermet Park
f733e42c95 portability: removed a compiler waring
D:\Projects\thorvg\src\loaders\lottie\tvgLottieParserHandler.h(52): warning C4083: expected ')'; found identifier 'effc'
[44/46] Compiling C++ object src/thorvg-0.dll.p/loaders_lottie_tvgLottieParserHandler.cpp.obj
D:\Projects\thorvg\src\loaders\lottie\tvgLottieParserHandler.h(52): warning C4083: expected ')'; found identifier 'effc'
[45/46] Compiling C++ object src/thorvg-0.dll.p/loaders_lottie_tvgLottieParser.cpp.obj
D:\Projects\thorvg\src\loaders\lottie\tvgLottieParserHandler.h(52): warning C4083: expected ')'; found identifier 'effc'

I'm not sure this option is really necessary.
2024-03-29 16:41:32 +09:00
Hermet Park
128923c05d lottie: polish up a comment. 2024-03-29 16:41:22 +09:00
Hermet Park
e69d63688b lottie: Removed redundant code.
The settings were incorrect;
'direction' and 'fillRule' do not have a relationship.
2024-03-29 13:45:19 +09:00
Hermet Park
a1463cdc3e lottie: optimize the rendering performance.
this optimization nicely merges shapes
when a child group has a only (transformed) pathes.

this also fixes the following compatibility issue nicely.

issue: https://github.com/thorvg/thorvg/issues/2061
2024-03-29 12:28:16 +09:00
Hermet Park
41ae563a84 lottie: optimize the rendering by preventing partial rendering branches.
this optimization is to figure out if this group is a simple path drawing.
In that case, the rendering context can be sharable with the parent's.
2024-03-29 12:28:16 +09:00
JunsuChoi
fdebb15dcb loader/svg: Check whether href id of use is parent or not
When finding the 'nodeFrom' referenced by `<use>`,
if it is the parent, it is not referenced.

https://www.w3.org/TR/SVG2/struct.html#UseElement
Specification:
If the referenced element is a (shadow-including) ancestor
of the ‘use’ element, then this is an invalid circular reference
and the ‘use’ element is in error.

related issue: https://github.com/thorvg/thorvg/issues/2078
SVG_FILE_65171.svg
SVG_FILE_65172.svg
2024-03-28 22:53:57 +09:00
JunsuChoi
46448a1520 loader/svg: Do recalc after gradient inheritance
Inherit gradientUnits and recalculate each element
radial(cx, cy, r,...), linear(x1, y1, x2, y2).

related issue: https://github.com/thorvg/thorvg/issues/2078
2024-03-28 22:52:45 +09:00
Hermet Park
d6504ed35d doc: List the parameters in their respective order. 2024-03-28 14:01:17 +09:00
Sergii Liebodkin
7a9b23fe71 wg_engine: render buffers usage refactorings
[issues 1479: strokes](#1479)

- update buffers via memory mapping
- refactoring of winding fill rule computation
2024-03-28 10:49:29 +09:00
Hermet Park
41f835598a lottie: code refactoring.
removed unused static condition.

static was prepared for optimization,
but not used at all.

we will revisit this later when time permits.

binary size: -6kb
2024-03-28 00:04:48 +09:00
Jinny You
ca7b59876a lottie: Fix crash from invalid masking method
This change is better for stability. Returns `None` if the `mode` attribute cannot be parsed.

related issue: #2072
2024-03-27 23:39:34 +09:00
Hermet Park
925009c4a5 sw_engine: stabilize the contour composition logic.
there has been a logical error that breaks the contour
composition context. This fixes it.

issue: https://github.com/thorvg/thorvg/issues/2093
2024-03-27 23:38:46 +09:00
Jinny You
0d0f6d4710 lottie: Fix crash when an invalid gradient is provided
When lottie is broken and provides invalid gradient, the program crashes in segmentation fault.

At that time, in the `populate` function, `ColorStop& color` doesn't have `input` but tries to use it.

Added checking nullptr logic. The function `populate` will not proceed and return 0 in that case.

related issue: #2072
2024-03-27 20:25:57 +09:00
Hermet Park
e4775727eb api: Promote experimental Animation APIs to official status.
These APIs have been thoroughly tested and verified.

New API:
- Result Animation::frame(float no)
- Picture* Animation::picture() const
- float Animation::curFrame() const
- float Animation::totalFrame() const
- float Animation::duration() const
- static Animation::std::unique_ptr<Animation> gen()

New CAPI:
- Tvg_Animation* tvg_animation_new()
- Tvg_Result tvg_animation_set_frame(Tvg_Animation* animation, float no)
- Tvg_Paint* tvg_animation_get_picture(Tvg_Animation* animation)
- Tvg_Result tvg_animation_get_frame(Tvg_Animation* animation, float* no)
- Tvg_Result tvg_animation_get_total_frame(Tvg_Animation* animation, float* cnt)
- Tvg_Result tvg_animation_get_duration(Tvg_Animation* animation, float* duration)
- Tvg_Result tvg_animation_del(Tvg_Animation* animation)

issue: https://github.com/thorvg/thorvg/issues/2067
2024-03-27 16:18:42 +09:00
Hermet Park
1f996c1382 sw_engine: rectify consecutive line drawings.
There are differences in behavior compared to the SVG spec,
especially when consecutive line drawings occur without a moveTo command
following a closePath command.

Actually, thorvg didn't care the behavior in that scenario,
this update ensures the scenario is handled correctly
to align with the SVG specification.

issue: https://github.com/thorvg/thorvg/issues/1487
2024-03-27 10:53:32 +09:00
Hermet Park
06cc9709e6 renderer: Fix a crash issue related to the clipper
Fixed a crash that occurred when a given clipper had no data.
Properly handle this exceptional case to prevent the crash.

issue: https://github.com/thorvg/thorvg/issues/2083
2024-03-26 09:41:24 +09:00
Jinny You
f48137505b lottie/slot: Fixed potential overriding bug
Slot overriding tries to set property via the `LottieObject`. It potentially causes unexpected changes.

Revised the `override` function. The purpose of this patch is to aim atomic property to be overriden.
2024-03-26 09:41:12 +09:00
Sergii Liebodkin
bcaa5db269 wg_engine: stroke trim
[issues 1479: strokes](#1479)

Introduced stroke trim setting

left: (0, 0.95)
middle: (0.15, 1)
right: (0.15, 0.95)
2024-03-25 12:34:24 +09:00
Vincent Torri
2ec9fdb932 [common] code clean up
use fmodf() instead of fmod()
2024-03-23 11:45:11 +09:00
vtorri
04977c43f1
[common] code clean up
use MATH_PI and MATH_PI2 instead of M_PI and M_PI_2
2024-03-22 23:48:25 +09:00