Commit graph

3388 commits

Author SHA1 Message Date
Mira Grudzinska
213bc2c865 bump up version v0.15.14 2025-07-22 16:23:15 +02:00
Mira Grudzinska
f204c3e2aa svg: fix nested use nodes
Previously, only single-level <use> references were supported.
If a <use> node pointed to another element that itself contained
a <use> node, the reference wasn’t resolved.
This has been fixed by replacing the array of postponed elements
with a list. The list is traversed, and nodes aren’t cloned while
they or any of their children remain unresolved. In such cases,
the target element also gets added to the list, enabling recursive
resolution of nested href references.

issue: https://github.com/thorvg/thorvg/issues/3615
2025-07-22 16:11:51 +02:00
Hermet Park
c2db6f0196 sw_engine: support the fast drop shadow version
The direct raster version has been restored with a proper fix
for the out-of-range bug.

see history: 78753eed31
2025-07-22 16:11:51 +02:00
Hermet Park
e332b541bf sw_engine: improved the dropshadow effect support
- shadow rendering was skipped when the blur value was 0.
  it now correctly renders shadows without blur.

- this also fixes the distance offset scalability.

issue: https://github.com/thorvg/thorvg/issues/3602
2025-07-22 16:11:51 +02:00
Hermet Park
a68f541e54 sw_engine: rectified softlight blending equation
slightly adjusted the equation for adobe/figma alignment
2025-07-22 16:11:51 +02:00
Hermet Park
8c3e40472c renderer: fixed a wrong fillrule option
- fixed to use the default option NonZero fillrule.
- updated the doc about text font as well
2025-07-22 16:11:51 +02:00
Mira Grudzinska
cacd7d442a renderer: fix render region for multiple masks
Previously, when more than two masks were applied,
the render region only took the first added mask into
account.

@Issue: https://github.com/thorvg/thorvg/issues/3600
2025-07-22 16:11:51 +02:00
Hermet Park
5d12df7aa0 sw_engine: dropshadow stability++
removed the direct rendering optimization of the dropshadow,
because it's a buggy.
2025-07-22 16:11:51 +02:00
Hermet Park
68f3e54cec lottie: adjusted the effect distance 2025-07-22 16:11:47 +02:00
Hermet Park
2ea09f0edb lottie: arrange the blur quality
there are several reports about poor quality,
arranged the value to the medium level.
2025-07-22 12:46:33 +02:00
Mira Grudzinska
1f0ff00651 lottie: prevent mem leak
Masks of pooled shapes were not unrefed, filling up
the memory pool.
2025-07-22 12:46:33 +02:00
Mira Grudzinska
955c5b60b2 lottie: ensure proper shape closure
- Ensured proper closure of star and polygon shapes.
The start and end points now match - in cases with
degenerate bezier curves, the second-to-last point
is also aligned.
Proper shape closure is necessary for modifiers like
offset (future pucker bloat). If the start and end
points aren’t equal (within the comparison function’s
precision), the shape will be closed with a straight
line - and during offsetting, that line will become
visible, even though it’s not intended.

- Use of the internal _zero() function for point equality check
in modifiers algs led to incorrect results when p2.x or p2.y
was zero (division by zero).
The intent was to treat nearly identical points as equal, but
this approach was flawed - at the modifier stage, it’s no longer
possible to tell if small gaps are intentional or just due to
limited numerical precision (as seen for example in the difference
between the start and end points of star/polygon shapes).
2025-07-22 12:46:33 +02:00
Mira Grudzinska
68f01c85fa sw_engine: fix focal point clamping
This approach should be introduced in d8ebd8b4f5.
Using FLOAT_EPSILON is not sufficient due to numerical precision,
since it's later inverted, and its very small value leads to
significant errors during inversion.
2025-07-22 12:46:33 +02:00
Mira Grudzinska
0c9a1d3f07 sw_engine: clamp focal point to the edge
If the radial gradient's focal point lies outside
the end circle, it's projected onto the edge.
A slight inward offset is applied to avoid numerical
issues.

Note:
Focal point support in the sw and wg engines is
consistent with the SVG 1.1 standard, whereas the gl
engine aligns with the SVG 2.0 standard.
2025-07-22 12:46:33 +02:00
Mira Grudzinska
3862fa802f avx/neon: remove double increment of the value
The span was incremented both in the for loop instruction
(ARRAY_FOREACH) and inside the loop body. Fixed.

@Issue: https://github.com/thorvg/thorvg/issues/3547
2025-07-22 12:46:33 +02:00
Hermet Park
8b864c0c23 gl_engine: ++safety 2025-07-22 12:46:33 +02:00
Hermet Park
3889ffe8ec engines: manage the update with the precise update flags
this also fixes one broken clipping issue.

issue: https://github.com/thorvg/thorvg/issues/3448
2025-07-22 12:46:28 +02:00
Hermet Park
d33a3e53f5 renderer: precise condition check for skip compositions
single child picture would not also requre composition in a scene
2025-07-21 21:26:20 +02:00
Mira Grudzinska
5150947304 lottie: fix offset with miter join
One point was skipped during the creation of the offset
corner. The error was not visible because the point lies
on the line, but it will become apparent if further
modifiers are applied to the object (not supported now).
2025-07-21 21:25:09 +02:00
Hermet Park
d9960203b0 sw_engine: revised the texture clipping
previous logic doesn't work if the clipping shape
has any inner corners. replace the logic
with a intermediate composition approach for
stability.

- performance can be drop at texture clipping by ~11%
- size is reduced by -0.5kb

issue: https://github.com/thorvg/thorvg/issues/3520
2025-07-21 20:16:44 +02:00
Hermet Park
b1bfd22487 renderer: chores++ 2025-07-21 14:30:41 +02:00
Hermet Park
e0d4ab2f68 renderer: increased the reference count capacity
255 is enough size in general but a bit limited.
2025-07-21 14:29:45 +02:00
Hermet Park
1e75f2fe7f lottie: do not try matting if the layer has no contents 2025-07-21 14:27:19 +02:00
Hermet Park
a2f9b30c58 lottie: fixed a repeater opacity logic
preserve the target opacity by multiplying,
do not overwrite it.
2025-07-21 14:26:55 +02:00
Hermet Park
16d3ff75dc sw_engine: skip AA if texture are orthogonally rotated.
there is no necessary applying AA for 0/90/180/270 degree rotation

issue: https://github.com/thorvg/thorvg/issues/3452
2025-07-21 14:26:40 +02:00
Sergii Liebodkin
bd2ee236e7 gl_engine: fix compilation warning with RenderRegion data type 2025-07-21 14:26:30 +02:00
Mira Grudzinska
a27839e80a lottie: fix precomposition with masking
A precomposition layer is clipped to its viewport.
If the same layer also had a mask that was optimized
using clipping, this clip was unintentionally overridden
by the viewport clipping. This conflict is now fixed.
2025-07-21 14:26:13 +02:00
Mira Grudzinska
c597365b99 bump up version v0.15.13 2025-05-24 13:51:26 +09:00
Hermet Park
e010e22df2 example: corrected reveresed arguments 2025-05-24 13:51:26 +09:00
Mira Grudzinska
031dd647bc sw_engine: fix too small memory alloc for spans
In some clipping cases, the memory allocated for storing spans
was too small. As a result, the entire clipped area might not
have been rendered.
This has been resolved by adding an experimental factor to increase
the size of allocated memory.

@issue: https://github.com/thorvg/thorvg/issues/3461
2025-05-24 01:37:24 +09:00
JunsuChoi
fda24c3f59 svg_loader: Fix <stop> being registered in closed latestGradient
If stop is declared immediately after Gradient is closed, the stop is registered in latestGradient.
Change latestGradient to a Stack and add a stop only to the last added gradient.
When that gradient is closed, no more stops should be registered for that gradient.
And gradients do not allow nested declarations, so only the earliest declared Gradient is valid.
2025-05-24 01:37:24 +09:00
Hermet Park
d7db54ea5e lottie: removed undesired embedded option.
Use local font by default and fall back if no glyphs exist.

Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>
2025-05-24 01:37:24 +09:00
Jinny You
450b0fe92b lottie: handle time remapping with zero value correctly
The time remapping logic had an issue where animations with zero value "tm"(Time Remap) were not being processed correctly.

This was happening because the previous implementation only applied time remapping when the value was non-zero. (A zero-value Time Remap should be applied, but is ignored)

The fix changes the default time remap value to `-1.0` (since frame values cannot be negative) and applies time remapping when the value is 0.0 or greater. This ensures that zero value time remapping is properly processed.
2025-05-24 01:37:24 +09:00
Mira Grudzinska
751ad1c1ec lottie: fix points calculation for rounded polygon
Added missing factor.

issue: https://github.com/thorvg/thorvg/issues/2629
2025-05-24 01:37:24 +09:00
Hermet Park
bb6458b50a sw_engine: fixed a a regression bug during main dev
borker by 14130e7e72afaecff2dd091e5e272169c79515b9
2025-05-24 01:37:24 +09:00
Mira Grudzinska
a6898ccf42 lottie: enhance parsing of position's SeparateCoords
The "s" key does not have to appear at the beginning
of the position block. Previously, such cases would
result in a parsing error — now they are handled correctly.
2025-05-24 01:37:24 +09:00
Hermet Park
a21ecdc1ae lottie/parser: revise logic to handle exceptional cases more gracefully
- prioritize valid (positive) cases first
- continue parsing even when encountering parsing errors

Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>
2025-05-24 01:37:24 +09:00
Mira Grudzinska
00f6600499 svg_loader: fix clipping in use/symbol nodes
Clipping for the <use> node when a <symbol> was used,
was being overridden when 'overflowVisible' was 'true'
(the default value), which caused the 'clip-path' applied
to the <use> node to have no visible effect.
The clipping for the <use> node (without <symbol> node) was
transformed in an incorrect order, resulting in a visually
incorrect results.

@Issue: https://github.com/thorvg/thorvg/issues/3392
2025-05-24 01:37:24 +09:00
Hermet Park
ea6cfdf3da lottie/expressions: --memory leak 2025-05-24 01:37:24 +09:00
Hermet Park
e1beceba80 lottie: fixed a invalid memory access
looping doesn't make sense if the animation
doesn't have frames. use the current frame number.
2025-05-24 01:37:24 +09:00
Hermet Park
1b37743b2c renderer: fixed a clippging update isssue
ThorVG did not consider updates to the clipping path
when a paint object was modified after being added to the scene.

This fix ensures that any updates to clipping are correctly
reflected during rendering.

issue: https://github.com/thorvg/thorvg/issues/3403
2025-05-24 01:37:24 +09:00
Hermet Park
8b2024a8f4 lottie/expressions: hotfix
issue: https://github.com/thorvg/thorvg/issues/3400
2025-05-24 01:37:24 +09:00
Mira Grudzinska
852424e69d ttf: prevent crash while converting utf8 to unicode
If wrong utf8 sequence if given as an input, decoding
return nullptr and it has to be handled correctly.
2025-05-24 01:37:24 +09:00
Mira Grudzinska
ee8eebfef8 lottie: safety++
Prevents a crash when the font family in the text document
does not match any font in the provided font list.
2025-05-24 01:37:24 +09:00
Hermet Park
55c0849746 loaders: explicit variable scope to improve portability
issue: https://github.com/godotengine/godot/pull/105093
2025-05-24 01:37:24 +09:00
Hermet Park
126265feb9 lottie/expressions: tiny optimization
reuse the user callback data by the reference count.
2025-05-24 01:37:21 +09:00
Jinny You
08fa801461 lottie/text: added range selector flags
Duplicated text document properties (fill color, stroke color, and stroke width) to the text range.

If these properties are not defined in the range selector, ThorVG incorrectly overrides them with default values.

The correct behavior is to preserve the original values. The added flags address this issue.

Co-Authored-By: Hermet Park<hermet@lottiefiles.com>
2025-05-22 16:58:24 +02:00
Mira Grudzinska
91bd6f35b9 bump up version v0.15.12 2025-04-05 12:24:05 +09:00
Hermet Park
dd416e326d loaders: ++static loader thread safty
make it sync before deleting the loaders.
2025-04-03 22:31:07 +02:00
Hermet Park
96d4ab1590 lottie/expressions: support wiggle effect
usage: wiggle(freq, amp, octaves=1, amp_mult=.5, t=time)

issue: https://github.com/thorvg/thorvg/issues/1640
2025-04-03 22:28:04 +02:00