Commit graph

2866 commits

Author SHA1 Message Date
Hermet Park
de75c58b89 test: clean up test suites
Merge two separate units: SwCanvas and SwCanvasBase.
2024-05-18 18:10:50 +09:00
Hermet Park
39fb3ed478 examples: added a viewport sample 2024-05-18 18:10:50 +09:00
Hermet Park
7ea17d4e72 capi: support canvas viewport api
New Experimental API:
- Tvg_Result tvg_canvas_set_viewport(Tvg_Canvas* canvas, int32_t x, int32_t y, int32_t w, int32_t h);
2024-05-18 18:10:50 +09:00
Hermet Park
42409987e2 renderer/engines: support the canvas viewport function.
The viewport function defines the rectangular area of the canvas
that will be used for drawing operations.

It is used to clip the rendering output to the boundaries of the rectangle.
Apps can use this function to set the drawing region within the canvas.

When the ThorVG canvas is partially inside the screen area such as during scrolling
it could help enhance rendering performance.

New Experimental API:
- Result Canvas::viewport(int32_t x, int32_t y, int32_t w, int32_t h) noexcept;

Issue: https://github.com/thorvg/thorvg/issues/2274
2024-05-18 18:10:50 +09:00
Hermet Park
70708211fe renderer/canvas: revise the logic.
introduce a status variable to identify
the condition precisely.
2024-05-18 18:10:50 +09:00
Hermet Park
7e5800df89 renderer/engines: added mainSurface() interface.
This interface expects the main surface of the raster engine.
2024-05-18 18:10:50 +09:00
Sergii Liebodkin
46041111d8 wg_engine: Text support
[issues 1479: Text](#1479)

EvenOdd fill rule reorganized: using global bbox of whole path for fill
2024-05-18 18:10:28 +09:00
Mira Grudzinska
7581b08c69 lottie: fix build error without extras
After introducing roundness support, the build
process did not ensure proper compilation
for the case without expression support.
2024-05-17 23:10:10 +09:00
Hermet Park
f02fccf57c lottie: keep the code clean and neat.
- Separate the rounded corner logic from the updateStar
  since its logic has become too lengthy and complicated.
- Revise the path generation to eliminate duplicates.
2024-05-16 19:41:56 +09:00
Mira Grudzinska
dc6ddd83f5 lottie: implement skew transformation
Added support for skew transformation by
a specified angle around a specified axis.
Applied to layers and shapes, not to repeaters.

@Issue: https://github.com/thorvg/thorvg/issues/2262
2024-05-16 17:50:37 +09:00
Jinny You
baaae5e416 test/lottie: added the slot resetting in animated property case 2024-05-16 17:46:54 +09:00
Mira Grudzinska
3b22f008f7 lottie: fix access violation while updating
Fix access issue when iterating over children
in case of an empty container.

@Issue: https://github.com/thorvg/thorvg/issues/2283
2024-05-16 17:00:10 +09:00
Hermet Park
dd091f4e0c lottie: fix compiler warnings. [-Wsign-compare] 2024-05-16 13:50:15 +09:00
Mira Grudzinska
3077d983e6 lottie: handle roundness in path
Implemented rounding of corners between
bezier curves that are straight lines.

@Issue: https://github.com/thorvg/thorvg/issues/2230
2024-05-16 12:51:16 +09:00
Mira Grudzinska
638f42f19e lottie: support rounded stars
Implementation of the roundness property
for a polystar. Only the corners that were
not subject to rounding by the inner or
outer roundness parameters are affected.

@Issue: https://github.com/thorvg/thorvg/issues/2230
2024-05-16 12:51:11 +09:00
Hermet Park
f53a331558 infra/gl_enigne: fallback use gles v2 if the system doesn't have v3.
let's keep this for a while until our minimum requirement is clear.
2024-05-15 14:54:41 +09:00
Hermet Park
03d2505b0a wg_engine: code refactoring
Use the override specifier so that
a compiler could warn any human mistake.
2024-05-14 17:14:32 +09:00
Hermet Park
430a6b4ad7 lottie: refactoring key frame logic.
compare floating-point values properly
to avoid potential precision loss.
2024-05-14 15:28:48 +09:00
Hermet Park
ad183c0586 test/animation - added a frame counting test-suite. 2024-05-14 15:28:48 +09:00
Hermet Park
38bd34b01f animation/lottie: improved the precision of frame values.
Refined the logic for updating frame numbers
to ensure greater accuracy in value precision.

issue: https://github.com/thorvg/thorvg/issues/2266
2024-05-14 15:28:48 +09:00
Mira Grudzinska
6a9a390e9d test: fix margin value
The precision margin for the comparison
has been set to 0.01f instead of 004004.
2024-05-14 13:22:49 +09:00
Jinny You
7f6311f95f lottie/slot: Fix slot resetting bug
When resetting back to animated property, system causes an UAF because frames have been freed.

Mark frames in nullptr at the case, so it doesn't use frame data after freed.

Issue: #2255
2024-05-13 21:35:19 +09:00
Hermet Park
b2695a121c gl_engine: updated GLES minimum requirement from v2 to v3
GLES v3 was introduced many years ago;
we are now dropping support for GLES v2.

issue: https://github.com/thorvg/thorvg/issues/2269
2024-05-13 17:27:08 +09:00
Hermet Park
b2adb2b8f3 lottie: fixed a memory leak
Free the children data properly,
rarely observerd this, only when a layer is hidden.
2024-05-09 21:23:27 +09:00
Hermet Park
bbf182848f common: tweaking bezier computation for perf.
It will sacrifice precision that is not noticeable
and instead try to improve performance.

Approximately 5% has beeen improved at Lottie example
2024-05-09 19:50:01 +09:00
Hermet Park
b001b46c49 examples/lottie: updated resources 2024-05-09 14:58:52 +09:00
Hermet Park
c7e8f0c476 lottie: code refactoring.
text tracking is an optional property.
it's good to initialize it with 0.
2024-05-09 14:58:52 +09:00
Jinny You
1e7cf2f5f9 lottie/text: Support text tracking
Text Tracking value("tr") is parsed and never used.

Calculate text spacing size via the tracking offset.

Issue: #2254
2024-05-09 14:27:49 +09:00
JunsuChoi
6bf069fa7a example: Sync setting size and window default size
When WIDTH and HEIGHT values change,
the default size of the window also changes.
2024-05-09 11:56:48 +09:00
Hermet Park
83cae2885a common/array: ++safety
do not try memory copy if the size is 0.
2024-05-09 11:51:18 +09:00
Mira Grudzinska
ed14966144 svg_loader: move the display property to the style
The display property, like any other node's style property,
should be part of a node style. This ensures its correct
copying and inheritance.
For the 'symbol' node, which is not rendered unless it is
used within a 'use' node, the display property can also be
applied. Because of that it cannot be utilized during scene
construction to determine whether the symbol is being defined
or used within a 'use' context.
2024-05-09 10:36:54 +09:00
Hermet Park
fe1d3db070 lottie/expressions: fix a build break on windows. 2024-05-09 10:27:39 +09:00
Hermet Park
c40b9fe47f lottie/expressions: fixed a memory access violation.
Reset memory after freeing the singletone instance.
2024-05-09 10:27:39 +09:00
Hermet Park
ac295f32e2 test: corrected wrong implementation.
identifier should have been methods.
2024-05-09 10:27:39 +09:00
Hermet Park
db71bc5b55 infra: add extra build options for flexible ThorVG composition
this commit introduces an additional build options:

- lottie expressions: this advanced feature in Lottie can
significantly increase binary size. Users now have the option
to enable or disable it based on their requirements.

Note that, this change introduces one config definitions:

- THORVG_LOTTIE_EXPRESSIONS_SUPPORT
2024-05-09 10:27:39 +09:00
Mira Grudzinska
8c4879f15d common: fix a precision issue in appendArc api
For angles close to multiples of pi/2, precision
based on FLT_EPSILON was insufficient. It either
led to the creation of an additional cubic segment
filled with erroneous values or NaNs, or it resulted
in the drawing of an angle for a sweep close to 0.
2024-05-08 22:08:36 +09:00
Hermet Park
4370fc7fb3 infra: update the compiler options
- applying robust build options
- aligning options between gcc/clang compilers.
2024-05-08 22:08:19 +09:00
477714778c sw_engine/neon: arm neonRasterPixel32 function to support aarch64
Improved the speed through neon processing.

Improvements Rate:
Lottie: (0.026321/0.026779) = +1.8%
Performance: (0.015411/0.015732) = +2.1%

issue: https://github.com/thorvg/thorvg/issues/30
2024-05-07 19:47:37 +09:00
Mira Grudzinska
8c04b9d65e svg_loader: improved clarity, no logical changes
Unnecessary structure removed, typos corrected,
comment added, an unused function argument removed.
2024-05-07 11:57:29 +02:00
Mira Grudzinska
c33068d17a svg_loader: paintOrder property properly copied
The paintOrder property set by the style was
not being copied. Now fixed.
2024-05-07 11:50:04 +02:00
c1394668ef sw_engine : arm neonRasterGrayscale8 function to support aarch64
Improved the speed through neon processing.

Improvements Rate:
Lottie: (0.025986/0.026201) = +4.7%
Performance: (0.014163/0.014785) = +4.3%

issue: https://github.com/thorvg/thorvg/issues/30
2024-05-07 14:05:57 +09:00
Hermet Park
c8551d4856 lottie/expressions: minor size down expressions engine.
- disable unused builtin realm functions.
- disable global this
- disable regexp (potential)
- disable unicode case conversion (potential)

Some features are marked with (potential)
since we are not certain these are used practically.

until now, total binary size diff by expressions: +287kb
2024-05-07 11:10:49 +09:00
Hermet Park
18b9e8141d
Update README.md 2024-05-07 01:51:20 +09:00
Hermet Park
0ad9630d0e lottie/expressions: ++exceptional handling
Stop handling if the interpreting result is invalid.
2024-05-06 14:32:34 +09:00
Hermet Park
c0582d8d2d lottie/expressions: apply expressions to missing properites. 2024-05-06 11:14:23 +09:00
Hermet Park
81ff238fef lottie/expressions: enhance stability
When the system fails to interpret the expression code,
it forcibly disables the feature per property.

This improvement enhances stability and performance
by avoiding reckless attempts to interpret JavaScript code.

When we confirm the full stability with expressions,
we can revert this code.
2024-05-06 11:14:23 +09:00
Hermet Park
0ea0def99d lottie/expressions: ++exceptional handling.
Add an exceptional handling if interpreting code is failed.
2024-05-06 11:14:23 +09:00
Hermet Park
830e5de0ce lottie/expressions: make it up the insufficient content() behavior
this is a follow-up fix for the initial expressions feature.
2024-05-06 11:14:23 +09:00
Hermet Park
1b4502bade lottie: fix a logic by a mistake. 2024-05-06 11:14:23 +09:00
RuiwenTang
9521e80e4c gl_engine: fix stencil logical not correct
Fix the stencil reference and compile function cause rendering not
correct
2024-05-06 11:02:35 +09:00