Commit graph

2862 commits

Author SHA1 Message Date
Mira Grudzinska
580019b64b gl_engine: fix color burn/dodge edge cases
Aligned with sw_engine implementation.
2025-02-03 15:06:39 +09:00
Mira Grudzinska
e7e168a28b wg_engine: fix color burn/dodge edge cases
Aligned with sw_engine implementation.
2025-02-03 15:06:39 +09:00
Mira Grudzinska
41f10b9702 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-02-03 15:06:39 +09:00
Mira Grudzinska
9c864f3e99 common: more accurate clipped viewport rounding
Replaced ceil and direct casts with nearbyint to improve
viewport size calculation. This ensures consistent
approach with the fastTrack case in sw_engine.

@Issue: https://github.com/thorvg/thorvg/issues/3148
2025-02-03 14:54:03 +09:00
Hermet Park
746ca7f58b renderer: hotfix a nullptr memory copy 2025-01-30 23:18:28 +09:00
Hermet Park
6a7e6966c3 lottie: code refactoring++
improved readability and maintenance by separating
the path modifier from the default path operation.
2025-01-29 23:25:46 +09:00
Hermet Park
f8da536d1a lottie: code refactoring++
Unified the property expression and default version.
This also helps to reduce the binarys size (O3=4k, S=360kb)
2025-01-29 23:25:46 +09:00
Hermet Park
2b97cf7a0d lottie: code refactoring++
renamed internal variable for improved simplicity.
no logical changes.
2025-01-29 23:25:46 +09:00
Hermet Park
a67f90951c lottie: clean up code for maintenance
Point/Position is too ambuguous to classify,
Renamed them to LottieScalar and LottieVector,
and unify the duplicate logic among them.
2025-01-29 02:38:19 +09:00
Sergii Liebodkin
0ecd2c0fd4 engine: introduce scene effect dispose render method
to correctly remove RenderDate from effects it must be removed in the renderer
a new method has been added to the RenderMethod interface
2025-01-26 10:13:28 +09:00
Hermet Park
ebe4935dd0 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-25 02:43:17 +09:00
Sergii Liebodkin
83eb89c5c9 wg_engine: fix segmentation fault on windows with SVG examples
Some SVG files fails during tesselation on windows.
Fixed
2025-01-24 20:48:08 +09:00
Hermet Park
b8f2e3815a sw_engine: ++reference info 2025-01-23 12:32:31 +09:00
Mira Grudzinska
56799beefd
svg_loader: loc-- (#3149)
* svg_loader: loc--

Removed unnecessary initialization of variables
to 0.0/false/nullptr in memory allocated by calloc.
2025-01-22 13:25:24 +01:00
Mira Grudzinska
758aa932d7 gl_engine: add support for stroke/fill ordering 2025-01-22 16:24:29 +09:00
Hermet Park
fdd760a34f api: revised the animation segment specification
Changed the unit of the segment from a normalized value to frame numbers,
ensuring alignment with other frame control interfaces.

Note that This change may break backward compatibility.

issue: https://github.com/thorvg/thorvg/issues/3116
2025-01-22 13:03:48 +09:00
Abdelrahman Ashraf
53487421b5 chore(build): exclude webgpu_native for emscripten build
- Add platform check to exclude webgpu_native in meson.build
- Avoid requiring -Dbindings=wasm_beta for Emscripten builds
2025-01-21 22:55:15 +09:00
Hermet Park
7f6af7ebe6 svg: ++readability
!strcmp() -> STR_AS()
2025-01-21 12:41:31 +09:00
Mira Grudzinska
fbdc958623 svg: added filter and gaussian blur nodes support
@Issue: https://github.com/thorvg/thorvg/issues/1367
2025-01-20 17:24:06 +01:00
Hermet Park
b79d12a04d gl_engine: hotfix memory leak
issue: https://github.com/thorvg/thorvg/issues/3140
2025-01-20 21:27:06 +09:00
Mira Grudzinska
5752e75ff9 wg_engine: fix bug introduced in 07e73a9
Fixed loop condition.
2025-01-20 21:25:22 +09:00
Hermet Park
868a085262 lottie: expressions compactness++
expressions is an optional feature,
do not prepare expressions if the engine doesn't support it.
2025-01-20 19:24:46 +09:00
Hermet Park
44075aa0f0 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-20 17:46:53 +09:00
Hermet Park
ef41f3f79c sw_engine/texmap: tuning the blending logic
Compromed the translucent/opaque logic by unifying them,
for code size and maintenance.
2025-01-18 15:10:07 +09:00
Mira Grudzinska
abdb96b8a0 sw_engine: fix bug introduced in 07e73a9
The value of the variable 'i' was not modified
after the refactor, resulting in a reference to
an incorrect array element.
2025-01-17 18:33:19 +09:00
Hermet Park
df0658e2da 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-17 16:11:29 +09:00
Hermet Park
ecd4fb8a70 lottie/expressions: ++safety
Prevent segfault in case of the omitted name json data
2025-01-17 12:27:49 +09:00
Hermet Park
dfa05a5c43 common: neat & clean code++ 2025-01-17 00:46:03 +09:00
Jinny You
61028747c6
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 14:43:17 +09:00
Hermet Park
2d32c2a45c lottie: updated lottie apis doc
- removed useless return value info.
- removed all beta api tags.
2025-01-16 00:19:10 +09:00
Jinny You
4aba0caaad wasm: fix build issue in sw/wg build only case
- resolved EMSCRIPTEN_WEBGL_CONTEXT_HANDLE declaration problem.
- currentContext() should be also called after `mContext` is initialized.
2025-01-15 21:27:00 +09:00
Hermet Park
07e73a9e6f common: code refactoring
use ARRAY_FOREACH() for neat code and
accessing the memory efficiently than normal indexing.
2025-01-15 18:03:46 +09:00
Mira Grudzinska
096b834771 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-15 14:13:47 +09:00
Hermet Park
8f98681ea7 renderer: minor code clean++ 2025-01-15 12:24:32 +09:00
Hermet Park
1c3b958d5b svg: ++loc reduction 2025-01-14 21:04:45 +09:00
Hermet Park
2e35f4eabb doc: minor capi doc correction 2025-01-14 19:40:37 +09:00
Hermet Park
ce3f0a75e2 gl_engine: corrected ColorDodge, ColorBurn equation
issue: https://github.com/thorvg/thorvg/issues/3072
2025-01-14 12:19:18 +09:00
Hermet Park
48c8094d19 api: path api revision for v1.0
Unify the Path commands & pts getters.

C++ API modiciation:
- uint32_t Shape::pathCommands(const PathCommand** cmds) const
- uint32_t Shape::pathCoords(const PathCommand** cmds) const
 -> Result Shape::path(const PathCommand** cmds, uint32_t* cmdsCnt, const Point** pts, uint32_t* ptsCnt)

C API modification:
- Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tvg_Point** pts, uint32_t* cnt)
- Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const Tvg_Path_Commands** cmds, uint32_t* cnt)
 -> Tvg_Result tvg_shape_get_path(const Tvg_Paint* paint, const Tvg_Path_Command** cmds, uint32_t* cmdsCnt, const Tvg_Point** pts, uint32_t* ptsCnt)

issue: https://github.com/thorvg/thorvg/issues/3116
2025-01-14 11:47:28 +09:00
Jinny You
5361ad1617 common: optimize clamp() for reduced overhead in web 2025-01-13 22:41:55 +09:00
Hermet Park
f5aa347a70 api: renamed api for consistency
API modification:
- Shape::fillColor() -> Shape::fill()

issue: https://github.com/thorvg/thorvg/issues/3116
2025-01-13 16:53:14 +09:00
Hermet Park
a31eceeafa 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-13 15:07:57 +09:00
faxe1008
912752906c renderer: Fix loader logic for mimetype check
Fixes the logic of the mimetype check before trying to load with the
given mimetype.
2025-01-11 13:53:24 +09:00
faxe1008
0c09580cd4 common: Use explicit floating-point value types.
Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2025-01-10 12:16:13 +09:00
faxe1008
9a8173cc22 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-10 11:27:59 +09:00
Hermet Park
e72b4e6a9b webp: --compiler warning
warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=]
2025-01-09 23:45:19 +09:00
Hermet Park
3d6fe5ffae sw_engine: ++portability on macOS
fixed a runtime error report of the sanitizer
at data casting.

issue: https://github.com/thorvg/thorvg/issues/3102
2025-01-09 00:43:30 +09:00
Hermet Park
d72c740ac6 common: properly update the clamp()
A regression brokeage by da54c83b5f
2025-01-09 00:04:18 +09:00
Sergii Liebodkin
222e8a25a1 wg_engine: fix context handle passimg by ref
Use reference insted of value for context passing
2025-01-08 17:21:57 +09:00
Hermet Park
d2d93792df wg_engine: corrected ColorDodge, ColorBurn equation
issue: https://github.com/thorvg/thorvg/issues/3072
2025-01-08 13:54:09 +09:00
Hermet Park
084c7ff214 sw_engine: corrected blendings
corrected wrong ColorDodge, ColorBurn, Exclusion, SoftLight blendings

issue: https://github.com/thorvg/thorvg/issues/3072
2025-01-08 13:27:58 +09:00