Commit graph

3632 commits

Author SHA1 Message Date
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
Hermet Park
bc1ad7104d example: corrected reveresed arguments 2025-01-13 12:14:15 +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
Hermet Park
da54c83b5f common/math: revise clamp() aligning with the std style 2025-01-08 13:27:58 +09:00
Jinny You
2a6e3ca40a examples: add slot transform overriding samples 2025-01-07 16:03:37 +09:00
Jinny You
22872a7dd5 lottie/slot: Support transform slot overriding
issue: https://github.com/thorvg/thorvg/issues/2591
2025-01-07 16:03:37 +09:00
Hermet Park
3d999ca1db examples: revise the blending sample
Note that scene blending doesn't work properly
2025-01-07 12:16:07 +09:00
Mira Grudzinska
4818c70dd4 svg: specs ++
Completely remove an element if the applied clip/mask is empty.

@Issue: https://github.com/thorvg/thorvg/issues/3089
2025-01-07 11:05:33 +09:00
Hermet Park
a12accbc93 updated copyright 2025-01-03 14:32:31 +09:00
Mira Grudzinska
3643121956 lottie: enforce fill clipper over stroke clipper
After the stroke clipper is introduced, using clipping
requires ensuring that clipping is based on fill rather
than on stroke. Fixed now.

regression by: 324bff30d1
2025-01-03 11:52:38 +09:00
Mira Grudzinska
acc614ab2f sw_engine: prevent warning
Remove unused version of SUBPIXELS().
2025-01-03 10:24:46 +09:00
Mira Grudzinska
defec5e43b svg_loader: fix transformation order
If a clip was defined by a use node pointing
to a basic shape subject to transformation, and
the use node itself was translated, the order
of applying these transformations was incorrect.
2025-01-02 17:50:25 +09:00
Hermet Park
2fb925a2d7 sw_engine: corrected the rle cell building
Properly build the cell cover value
when a new cell value is just overlapped.

This fixes certain weird visual artifacts at a corner case.

issue: https://github.com/thorvg/thorvg/issues/2929
2025-01-02 17:49:28 +09:00
Hermet Park
47524300bb sw_engine: minor code clean up 2025-01-02 17:49:28 +09:00
RuiwenTang
3c6d686795 gl_engine: fix fbo and texture leak
GlRenderTarget contains framebuffer and render target objects,
these GPU resources need to be released before reusing the structure and calling init with the new size.
2024-12-31 16:25:11 +09:00
Hermet Park
12b3747d08 examples: updates svg resources 2024-12-31 14:02:26 +09:00
Hermet Park
7e810ce54d svg: fixed broken clip regression bugs
introduced by 8492a63

https://github.com/thorvg/thorvg/issues/3083
https://github.com/thorvg/thorvg/issues/3082
2024-12-31 12:36:04 +09:00
Hermet Park
5ea1db128e svg: remove styles from the clipPath
Main purpose clippath is to cutout the
drawing region with a path. Otherwise
we need to use MaskMethod.
2024-12-31 12:36:04 +09:00
Hermet Park
76203c3dbb gl_engine: ensure the gl context switching
This only covers emscripten environment,
need to cover other system.

issue: #3023

Co-Authored-By: Hermet Park <hermet@lottiefiles.com>
2024-12-31 12:07:52 +09:00
Jinny You
596de01b12 gl_engine: revise target API for context managing
Issue: #3024
2024-12-31 12:07:52 +09:00
Hermet Park
1cbc11cadd renderer: revamped engine interfaces
Introduced updated pre/post calls
for proper preparation of the drawing process.
2024-12-31 12:07:52 +09:00
Hermet Park
ccf5a8158f gl_engine: ++binary optimization
- removed unique_ptr, shared_ptr
- replaced std::vector with tvg::Array
- reduced binary size by -10kb
2024-12-30 22:24:53 +09:00
Jinny You
38a4465656 lottie: fix viewport clipping issue when resize
After resizing an animation, the base clipper for the viewport of the root scene did not update accordingly. This caused the animation to always be clipped by its initial size.

Additionally, this issue introduced a regression in v1 when the `Result Picture::size(float w, float h)` function was called.

issue: https://github.com/thorvg/thorvg/issues/3039
2024-12-30 14:52:42 +09:00
Mira Grudzinska
82dc41479e sw_engine: fix clipping
A shape with both fill and stroke, where clipping left
only a fragment of one (either fill or stroke), was not
rendered at all. Now fixed.
2024-12-30 12:01:24 +09:00