Commit graph

3341 commits

Author SHA1 Message Date
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
Jinny You
dec4b141ec lottie/slot: fix potential memory leak when overriding twice
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-03-12 20:26:39 +01:00
Mira Grudzinska
c6960502eb sw_engine: hanndle empty clips
Generating the outline may return false, e.g., if the shape
is completely trimmed. If such a shape was used as a clip,
an attempt to generate 'rle' will still be made. In such a case,
a crash will occur because the outline is nullptr.
2025-03-12 20:26:39 +01:00
Mira Grudzinska
572e5ef9b1 ttf_loader: handling contours starting with OFF_CURVE
It might happen that the first point doesn't belong
to the contour - such cases were observed as artifacts
till now.

@Issue: https://github.com/thorvg/thorvg/issues/3268
2025-03-12 20:26:38 +01:00
Mira Grudzinska
5114a87e3d gl_engine: fix line join while dashing
While dashing, changing the path command each time caused
a new 'move to' command to be added, even when dash segments
across different path commands should have been connected.

@Issue: https://github.com/thorvg/thorvg/issues/3231
2025-03-12 20:26:38 +01:00
Mira Grudzinska
4f7d94cd8b gl_engine: fix differences in dashing among engines
The differences resulted from discrepancies between
the engines in applying equality or inequality signs.

@Issue: https://github.com/thorvg/thorvg/issues/3265
2025-03-12 20:26:38 +01:00
Jinny You
52dc586089 lottie/expressions: Fix incorrect evaluation result check condition
A JavaScript code line may return undefined, but this should not be treated as an error.

For example, consider the following two lines of code:
- `var $bm_rt = 30` (Statement) → result: `undefined`
- `$bm_rt = 30` (Expression) → result: `30`

Both lines execute the same operation, but the JavaScript interpreter (REPL JS) evaluates them differently.

Therefore, an evaluation result of undefined should not be blocked, as it does not indicate a failed code execution.
2025-03-12 20:26:38 +01:00
Hermet Park
4ea95d8707 loader: fixed potential memory leaks in font handling
Simply loading a font doesn't mean it is in use.
Fixed the loader's reference count to prevent incorrect increments.
2025-03-12 20:26:38 +01:00
pharuxtan
07da6c5870 sw_engine: fix internal types of rasterXYFlip
Before the C++ compiler couldn't decide the template of std::min (that happen if `int` type is not an `int32_t`), so explicitly changing all types to int32_t fixes this.
2025-03-12 20:26:38 +01:00
Mira Grudzinska
41b340bbdb gl_engine: add offset support in dashed strokes
Offset is correctly applied to dashed strokes,
properly shifting the dash pattern.

@Issue: https://github.com/thorvg/thorvg/issues/3217
@Issue: https://github.com/thorvg/thorvg/issues/3223
@Issue: https://github.com/thorvg/thorvg/issues/3191
2025-03-12 20:26:32 +01:00
Mira Grudzinska
5b15db0c8e gl_engine: fix dashing
Incorrect condition for drawing segments in cubics;
missing checks.

@Issue: https://github.com/thorvg/thorvg/issues/2729
@Issue: https://github.com/thorvg/thorvg/issues/3222
2025-03-12 02:10:32 +01:00
Mira Grudzinska
0e633bd009 sw_engine: fix update issue
In cases where the fill was changed while the stroke existed
but remained unchanged, the stroke would disappear because it
was being reset during the shape preparing (shapeReset).
Fixed by disabling the reset of stroke rle from shape reseting.

Also the shape should be prepared not only when the RenderUpdateFlag
is set to Color, but also when it is set to Gradient.

@Issue: https://github.com/thorvg/thorvg/issues/3237
2025-03-12 02:10:32 +01:00
Mira Grudzinska
589e93fa74 lottie: parsing embedded fonts data (#3220)
Only parsing and font loading is added with
a very basic text update while building the scene.

@Issue: https://github.com/thorvg/thorvg/issues/3184
2025-03-12 02:10:32 +01:00
Hermet Park
7a1df343cc lottie: properly copy missing property values 2025-03-12 02:10:32 +01:00
Mira Grudzinska
1354613d59 lottie: ++ dashed stroke support
Until now lottie loader supported only a single
dash-gap pair, and only the case where only the dash
was provided was handled correctly. When both values
were provided, the gap was incorrectly increased by
the dash value. If more values were supplied, only
the last pair was considered.

@Issue: https://github.com/thorvg/thorvg/issues/3191
2025-03-12 02:10:32 +01:00
Hermet Park
7968b9668e sw_engine: fixed a broken dropshadow
corrected a mismatched stride value of the
direct drawing target buffer.

issue: https://github.com/thorvg/thorvg/issues/3146
2025-03-12 02:10:32 +01:00
Mira Grudzinska
0a76a4f0a3 gl_engine: fix color burn/dodge edge cases
Aligned with sw_engine implementation.
2025-03-12 02:10:32 +01:00
Mira Grudzinska
6a00eb8db0 sw_engine: fix color burn/dodge edge cases
Dodge d / (1 - s):
- handle d = 0 first to avoid 0/0 when s = 1
- for d != 0 and s = 1, the formula results in d/0 (infinity),
  which maps to 1 in the 0-1 range (or 255 in the 0-255 range)

Burn 1 - (1 - d) / s:
- handle d = 1 first to avoid 0/0 when s = 0
- for d != 1 and s = 0, the formula results in  1 - 0/0 -> 1 - inf = -inf
  Negative infinity in the 0-1 range corresponds to the minimum possible
  value, which is 0 (255 if we operate in 0-255 range).
2025-03-12 02:10:32 +01:00
Hermet Park
bca94d244c bump up version v0.15.10 2025-01-30 21:09:27 +09:00
Hermet Park
782f067b22 renderer: hotfix a null memory copy 2025-01-30 21:09:27 +09:00
Hermet Park
173edf62a1 portability: added cstdint header properly.
gcc15 is more strict at the header inclusion,
thorvg header should specify it since it reply on it.

issue: https://github.com/godotengine/godot/pull/102022#discussion_r1929547647
2025-01-30 20:37:01 +09:00
Hermet Park
09ebf10432 lottie: revise the effect parsing logic
Unify the common parts of the parsing logic
by applying a strategy pattern,
allowing the behavior to vary based on the effect type.

This helps to reduce the size and improved the parsing safety.
2025-01-30 20:36:02 +09:00
Mira Grudzinska
8f7103e109 gl_engine: add support for stroke/fill ordering 2025-01-30 20:32:45 +09:00
Hermet Park
89e98b6fcb sw_engine: Improved the blur performance by 12%
Applied the compromised approach for the gaussian blur
since the effect is a bit burdensome for cpu processing
as animatable effects.

- Optimized performance and quality with negligible observable differences.
- Disabled the border option until specific use cases are identified.
2025-01-30 20:24:20 +09:00
Hermet Park
819b93a9a4 renderer: improved engine for scalable effects
RenderMethod effects methods would have changes:
 + update()               //update the effects if any
 - prepare() -> region()  //update the effect drawing region
 - effect() -> render()   //draw the effect
2025-01-30 20:23:39 +09:00
Hermet Park
6c0c8865cd lottie/expressions: ++safety
Prevent segfault in case of the omitted name json data
2025-01-30 20:21:09 +09:00
Mira Grudzinska
825c1ab959 bump up version v0.15.9 2025-01-16 23:39:58 +01:00
Jinny You
c64624c8c8 sw_engine: Fix buffer overflow in texture mapping rasterizer
Fix heap buffer overflow in texture mapping rasterizer by adding proper
bounds checking for texture coordinates. This prevents accessing memory
outside of the allocated image buffer during texture sampling and
interpolation.

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>

issue: https://github.com/thorvg/thorvg/issues/3102
2025-01-16 18:50:32 +01:00
Mira Grudzinska
12b9c5fc53 lottie: fix text stroke's 'of' property
The text stroke's 'of' property determines whether
the stroke appears above (true) or below (false)
the fill.
Previously, it was incorrectly used to decide whether
the stroke would render.

@Issue: https://github.com/thorvg/thorvg/issues/3126
2025-01-16 18:49:49 +01:00
Hermet Park
c460591b39 gl_engine: corrected ColorDodge, ColorBurn equation
issue: https://github.com/thorvg/thorvg/issues/3072
2025-01-16 18:44:41 +01:00
Hermet Park
e815fd25e4 sw_engine: assign the stride omitted
This fixes a wrong compositor access
during the rasterization

issue: https://github.com/orgs/thorvg/discussions/3109
2025-01-16 18:41:19 +01:00
faxe1008
6489e65064 common: Use explicit floating-point value types.
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-01-16 18:34:12 +01:00
faxe1008
14ea212535 drenderer: include alloca.h for Zephyr
Changes the conditional for to also include the alloca.h header in case
it is build for the zephyr rtos.
2025-01-16 18:30:36 +01:00
Hermet Park
d7ad915647 webp: --compiler warning
warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=]
2025-01-16 18:30:19 +01:00