Commit graph

3374 commits

Author SHA1 Message Date
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
Hermet Park
558a9991de lottie: improve the compatiblity
merge the scene with more accurate condition to allow
the evenodd pathes among the lottie render tree.
2025-04-03 22:17:03 +02:00
Hermet Park
4e5ff3ea9a lottie: safety++
Don't apply matte — it's already been pushed into the scene.
This is a corner-case bug that occurs when the Lottie data
violates the specification.
2025-04-03 22:10:21 +02:00
Hermet Park
7d8bb168d2 ttf: ++thread safety
Properly allow the ttf loader sharable among threads.

issue: https://github.com/thorvg/thorvg/issues/3165
2025-04-03 21:31:52 +02:00
Hermet Park
ba00675559 renderer: safety++
introduced a threshold for the minimum dash size
to prevent excessive fragmentation.

issue: https://github.com/thorvg/thorvg/issues/3332
2025-04-03 21:17:54 +02:00
Hermet Park
aa697d9311 sw_engine: hotfix a out of bound image access.
this simply revert logic from the previous change:
https://github.com/thorvg/thorvg/pull/2552

issue: https://github.com/thorvg/thorvg/issues/3327
2025-04-03 21:13:46 +02:00
Hermet Park
6708fae17b common: ++loader thread safety
fortitfy the thread safety
in multi-threaded resource loading.

issue: https://github.com/thorvg/thorvg/issues/3306
2025-04-03 21:09:21 +02:00
Sergii Liebodkin
72a1b0339b gl_engine: luma visual differneces fix
https://github.com/thorvg/thorvg/issues/3045
2025-04-03 20:03:28 +02:00
Mira Grudzinska
7730b1d632 svg_loader: handle embedded fonts
It is possible to embed fonts directly into an SVG file.
Support for parsing and loading embedded fonts has been added.

@Issue: https://github.com/thorvg/thorvg/issues/1897
2025-04-03 18:56:45 +02:00
Jinny You
097d3814ea lottie/slot: fix image deep copy logic
When the datas are copied with deep copy, memory issue caused (SEGV on unknown address) due to these reasons:

1. `mimeType` is nullptr when it's not embedded(base64) data

2. datas(b64Data, mimeType) should not be clear, it's used for next slot copy in same pair.
2025-04-03 14:28:02 +02:00
Mira Grudzinska
61360cf6db bump up version v0.15.11 2025-03-12 21:02:51 +01:00
Mira Grudzinska
731f137d2d svg: fix incorrect assignment of <stop> elements
If the svg contained an unsupported element with <stop> elements,
they were incorrectly assigned to the last loaded gradient. Now fixed.

@Issue: https://github.com/thorvg/thorvg/issues/3321
2025-03-12 21:02:51 +01:00
Hermet Park
c554205238 sw_engine: fix a incorrect rle cell position.
All cells that are on the left of the clipping region
go to the - 1 horizontal position.

issue: https://github.com/thorvg/thorvg/issues/2657
2025-03-12 21:02:51 +01:00
Hermet Park
fe383d44e7 lottie: --compiler warnings
In member function ‘constexpr LottieGenericProperty<LottieScalarFrame<float>, float>& LottieGenericProperty<LottieScalarFrame<float>, float>::ope>    inlined from ‘LottieFloat& LottieStroke::dashValue()’ at ../src/loaders/lottie/tvgLottieModel.h:60:104,
    inlined from ‘void LottieParser::parseStrokeDash(LottieStroke*)’ at ../src/loaders/lottie/tvgLottieParser.cpp:623:82:
../src/loaders/lottie/tvgLottieProperty.h:297:8: warning: ‘<anonymous>.LottieGenericProperty<LottieScalarFrame<float>, float>::value’ may be used>  297 | struct LottieGenericProperty : LottieProperty
      |        ^~~~~~~~~~~~~~~~~~~~~
../src/loaders/lottie/tvgLottieModel.h: In member function ‘void LottieParser::parseStrokeDash(LottieStroke*)’:
../src/loaders/lottie/tvgLottieModel.h:60:104: note: ‘<anonymous>’ declared here
   60 |             for (uint8_t i = 0; i < dashattr->size; ++i) newValues[i] = LottieFloat(dashattr->values[i]);
      |
2025-03-12 21:02:44 +01:00
Jinny You
7c27ae021d lottie/slot: Support expressions overriding
issue: #3168

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-03-12 20:26:39 +01:00