Commit graph

2558 commits

Author SHA1 Message Date
Sergii Liebodkin
1794ec0924 wg_engine: antialiasing
[issues 1479: antialiasing](#1479)

Anti-aliasing implementation
Implements antialiasing as a post process on cimpute shaders and original render target with scale of 2x.
Can be modified as an external settings
2024-03-04 19:33:34 +09:00
RuiwenTang
7cf4bd932f gl_engine: use stencil and cover tessellator by default
Since we choose multisample antialiasing, use stencil then cover to
render polygon can get better performance.
Also the code is much easier to understand.
2024-03-04 17:38:11 +09:00
Hermet Park
199fac9b63
Update CONTRIBUTING.md 2024-03-04 15:14:03 +09:00
Hermet Park
8f28181699
Update CODEOWNERS 2024-03-04 15:11:08 +09:00
Mira Grudzinska
f535a6e139 sw_engine: fix a regression bug
After introducing the length measurement
of approximate and exact Bezier curves in
a8c0030d80
the calculation of the outline length still
used the approximate functions, while further
calculations took the exact value into account.
This discrepancy led to the creation of artifacts.

@Issue: https://github.com/thorvg/thorvg/issues/2021
2024-03-04 11:20:21 +09:00
Hermet Park
b95cb0441d
Update README.md
added the opencollective badge
2024-03-03 20:03:55 +09:00
Hermet Park
f10283a905 infra: added open_collective fund account 2024-03-03 19:54:20 +09:00
Hermet Park
32c16e3a6f sw_engine: fix a regression bug.
stroke line drawing has been broken at a certain case,
this reverts a part of change from the old optimization:

d81f5d29fb

note that this change wouldn't affect any performance.

issue: https://github.com/thorvg/thorvg/issues/2015
2024-03-03 16:17:23 +09:00
Hermet Park
103252642e lottie: code refactoring.
Maintains compact lines of code and functions without altering logic,
consistently prioritizing simplicity in software complexity metrics.
2024-03-03 14:04:34 +09:00
Hermet Park
a1dea56690 lottie: copy the data only necessarily. 2024-03-03 13:12:29 +09:00
Hermet Park
a741778dab saver: ++robustness
do not delete the given picture if the reference counting is
more than 0.
2024-03-03 12:56:33 +09:00
Mira Grudzinska
0c602291cb common: Changing the rounded rect starting point
According to the SVG standard, drawing a rectangle
starts at (x+rx, y) point. Till now it was (x+w, y+ry).
The difference was visible only for dashed strokes.
2024-03-03 12:54:56 +09:00
Mira Grudzinska
6ec88ed486 common: Changing the circle/ellipse starting point
According to the SVG standard, drawing a circle/ellipse
should start at the '3 o'clock' position and proceed
in a clock-wise direction. Until now, this point was
set at '12 o'clock'.
The differences in the outcome were visible for dashed
strokes.

issue: https://github.com/thorvg/thorvg/issues/1686
2024-03-03 12:53:10 +09:00
Mira Grudzinska
8b2ddf7377 lottie: use internal append rect/ellipse func
The lottie format defines the starting point for
drawing rectangles and ellipses differently than
the API available in the TVG. In the case of using
dashes or trim paths, this leads to discrepancies.
Therefore, when using the lottie builder, internal
functions for appending rectangles and circles are
utilized.

@issue: https://github.com/thorvg/thorvg/issues/1997
2024-03-03 12:52:39 +09:00
Hermet Park
651979b68d Update README.md
Added an thorvg NPM link in the Lottie Player documentation.
2024-02-29 11:36:45 +09:00
Hermet Park
faa3c6f392 examples: ++threading stability.
Ensure synchronous calls are made after updating the canvases.
2024-02-24 11:16:49 +09:00
Hermet Park
71a5c3ad02 binding/capi: support lottie extensions
these experimental apis are allowed to use
when the lottie loader is enabled.

APIs:
- Tvg_Animation* tvg_lottie_animation_new()
- Tvg_Result tvg_lottie_animation_override(Tvg_Animation* animation, const char* slot)
2024-02-24 01:57:35 +09:00
Hermet Park
65e8fe2791 lottie: clean up code and minor bugs by mistake. 2024-02-23 16:18:40 +09:00
Jinny You
625146853e examples: Added lottie advanced features example 2024-02-23 15:05:15 +09:00
Jinny You
53878919b5 lottie: Introduce the LottieAnimation class
This class extends the Animation and serves advanced Lottie features.
It's designed to separately have Lottie Animation's unique specs.

For now, this will have Slot overriding feature,
you can include <thorvg_lottie.h> for its extensive features.

@APIs:
- Result LottieAnimation::override(const char* slotJson) noexcept;
- static std::unique_ptr<LottieAnimation> LottieAnimation::gen() noexcept;

@Issue: https://github.com/thorvg/thorvg/issues/1808
2024-02-23 15:05:15 +09:00
Jinny You
362e6faacb lottie: Support the slot overriding feature
Internal model and parser modifications have been made
to parse "sid" and retrieve their data into the LottieComposition.
This will enable dynamic changes to the following Lottie objects:

The slot feature will encompass these properties:

- LottieSolidStroke
- LottieSolidFill
- LottieGradientStroke
- LottieGradientFill
- LottieTextDoc"

Issue: https://github.com/thorvg/thorvg/issues/1808

Co-authored-by: Hermet Park <hermet@lottiefiles.com>
2024-02-23 15:05:15 +09:00
Vincent Torri
a361924887 Lottie loader: fix compilation on windows
strlen() was used in tvgLottieModel.h without the inclusion of
cstring. This patch fixes this
2024-02-23 11:27:12 +09:00
Jinny You
4613d98d98 lottie: Revise the solid model
To ensure consistent properties, `LottieSolid` has been defined.

Both `LottieSolidStroke` and `LottieSolidFill` can be typecasted to the `LottieSolid`.
2024-02-22 22:17:11 +09:00
Jinny You
317843927f lottie: Revise the gradient model
Currently, the `LottieGradient` does not incorporate the `LottieObject` functionality.

It now inherits from the `LottieObject`.
2024-02-22 22:17:06 +09:00
JunsuChoi
d32c90cbbf svg: Improve valid check for url(#id)
Improve parenthesis checking and space checking.
 - There must be only one pair of parentheses.
 - There cannot be spaces(and ') between id strings.

Issue: https://github.com/thorvg/thorvg/issues/1983

Co-authored-by: Hermet Park <hermet@lottiefiles.com>
2024-02-22 21:51:19 +09:00
Hermet Park
27972ceaa7 gl_engine: fix a compile warnings, errors.
../src/renderer/gl_engine/tvgGlRenderPass.cpp:35:34: warning: macro expands to multiple statements [-Wmultistatement-macros]
   35 |     if (mColorTex != 0) GL_CHECK(glDeleteTextures(1, &mColorTex));
      |                                  ^~~~~~~~~~~~~~~~
../src/renderer/gl_engine/tvgGlCommon.h:33:9: note: in definition of macro ‘GL_CHECK’
   33 |         x; \
      |         ^
2024-02-22 13:09:00 +09:00
Hermet Park
4467ce7bd5 lottie: introduced LottieProperty base class
this is useful for slot & expression type casting.
2024-02-21 20:57:07 +09:00
Hermet Park
9e55eefe13 common: code refactoring
refactor common code to consolidate Bezier and line
function implementations into a single location.
2024-02-20 17:19:15 +09:00
Hermet Park
31b4428dd8 Revert "Revert "sw_engine: Increasing accuracy for dashed curves""
This reverts commit e49f9125b2.
2024-02-20 12:33:00 +09:00
Hermet Park
e49f9125b2 Revert "sw_engine: Increasing accuracy for dashed curves"
This reverts commit a8c0030d80.
2024-02-20 12:23:55 +09:00
Mira Grudzinska
a8c0030d80 sw_engine: Increasing accuracy for dashed curves
Dashed curves require greater precision in calculating
their lengths and while splitting Bezier curves.
Otherwise, it results in visual discrepancies compared
to the expected outcomes.
Approximate functions 'bezLengthApprox' and 'bezAtApprox'
used for calculations in the lottie loader.

issue: https://github.com/thorvg/thorvg/issues/1686
2024-02-20 12:11:43 +09:00
Mira Grudzinska
6377257f8c sw_engine: fixing stroke outline
In the case of non-uniform scaling for
thick strokes, artifacts were visible.
The calculations took into account the angle
resulting from the already transformed points,
whereas the untransformed points should have
been considered - the transformation is taken
into account in the next step.

@issue: https://github.com/thorvg/thorvg/issues/1915
2024-02-20 11:27:22 +09:00
Sergii Liebodkin
b150d71912 wg_engine: meson script fixed
[issues 1991: Basic steps to compile for linux (wg_beta, examples)](#1991)
2024-02-20 10:56:40 +09:00
JunsuChoi
8e899df130 examples/picture/svg: Adjust size ratio
Adjust the image size and position to fit the window size.
2024-02-19 23:54:06 +09:00
Hermet Park
fb19e2cabd lottie/parser: clean up the exception handling mechanisms.
Since the parser has become stable enough,
remove the exceptions and instead rely on parser error handling.
2024-02-19 21:26:58 +09:00
Hermet Park
043b6b9f4f common/array: code refactoring
Make the array interface pair begin()/end() for consistency.
2024-02-19 19:09:30 +09:00
Hermet Park
6d98e16cae
Update CODEOWNERS 2024-02-19 11:46:55 +09:00
Hermet Park
91c776affa loader/webp: do not expose webp apis.
this reduces the bin size around -1.5kb
2024-02-15 16:35:42 +09:00
Sergii Liebodkin
21b1ef6f5f wg_engine: animation optimizations (part 1)
[issues 1479: update](#1479)

gpu vertex buffer reallocations optimization
2024-02-15 12:03:27 +09:00
Hermet Park
11ddfdb193 lottie: remove the duplicated binary search logic. 2024-02-15 10:29:31 +09:00
JunsuChoi
53e2ecd81c loader/svg: Fix empty id to null
empty id is invalid. Therefore, set it to null and make it is not used.

issue: https://github.com/thorvg/thorvg/issues/1977
2024-02-15 10:29:13 +09:00
Jinny You
d8891187cd web: code refactoring
improved code consistency:
- removed double-quotes on string literal.
- removed double-equals (==)
- updated comments
2024-02-09 14:12:06 +09:00
Martin Capitanio
a9b6907e41 Portability: Fix compiler shadowing warning 2024-02-08 09:16:50 +09:00
Hermet Park
5fb0012ff4 webp: removed non-existing symbol methods. 2024-02-07 20:32:05 +09:00
Hermet Park
5fe9b432ec loaders: enhance decoding efficiency
enhance decoding efficiency by determining the desired canvas format
during image loading. This allows loaders to preemptively decode
the image in the specified format, to not convert the format again.
2024-02-07 20:32:05 +09:00
Hermet Park
8a4862bc37 loaders: decode the image with premultiplied alpha.
basically, the renderer requires images with premultiplied alpha.
2024-02-07 20:32:05 +09:00
Hermet Park
f0c69f5bbb Revert "lottie: compatibility++"
This reverts commit c89f6253bf.

No more valid by 3f235d9e3f
2024-02-07 20:22:05 +09:00
Hermet Park
20fcb5b1c2 renderer/loader: enhance picture format compatibility
Attempt to load a given file/data using candidate formats
when the desired loader fails. This approach will enhance
the compatibility with various file formats in unexpected scenarios.

Previously, we had removed this feature, but have since
recognized its necessity due to the impact on file data
in specific corner cases.
2024-02-07 20:22:05 +09:00
Hermet Park
42a5366735 renderer/canvas: fix a regression error.
just figured out & fixed a side effect by this change:
9e69089524
2024-02-07 19:22:32 +09:00
Hermet Park
9db82db7d7 infra: remove codeql.
Currently, CodeQL is not functioning, but we have applied another tool:
https://www.codefactor.io/repository/github/hermet/thorvg
2024-02-07 16:28:20 +09:00