Commit graph

660 commits

Author SHA1 Message Date
Hermet Park
4c3beb1cb1 sw_engine: --size reduction
basically, sw engine aims for 32bits, it reduces
the bundle size by 1kb.

Need to carefully see any side effect in practice.
2025-04-21 17:52:28 +09:00
Hermet Park
1a332acd37 renderer: revise the pImpl design with a better efficiency
The following is a redesign that extends the class internally.

The main goal is to preserve the characteristics of the pImpl idiom
for data encapsulation, while simultaneously reducing the memory
allocation overhead typically associated with pImpl.

The stragegy is here:
Rather than alloc the impl memory inside of the thorvg engine,
impl extends the API classes in order to consolidate the memory.

size has been decreased by -4kb with optimization=s

issue: https://github.com/thorvg/thorvg/issues/3214
2025-04-20 00:07:50 +09:00
Hermet Park
af7fb159d1 wg_engine: ++safety 2025-04-18 13:26:08 +09:00
Sergii Liebodkin
858205a132 webgpu: replace readonly strorages to texture2d (v24 migration)
https://github.com/thorvg/thorvg/issues/2909
2025-04-17 11:25:04 +09:00
Mira Grudzinska
a2f9b6da21 wg_engine: fix drop shadow blended color
The shadow color must be premultiplied. To avoid
repeating this operation in the fragment shader,
the passed shadow color is already premultiplied.
2025-04-17 11:18:47 +09:00
Mira Grudzinska
3b634064c9 gl_engine: fix drop shadow blended color
The shadow color produced incorrect results after
blending with the texture color. This was caused
by not taking the alpha value into account in the
specified shadow color (with OpenGL blending disabled).
2025-04-17 11:18:47 +09:00
Mira Grudzinska
3fbc36629f renderer: add missing RenderUpdateFlag
Flag was missing in the appendRect().
2025-04-16 18:38:51 +09:00
Hermet Park
176573ff25 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-04-16 18:37:56 +09:00
lpogic
feda6bcbc2 Added null check in Paint::Impl:clip
issue: https://github.com/thorvg/thorvg/issues/3404
2025-04-16 11:23:14 +09:00
Sergii Liebodkin
6c3fee84ec gl_engine: introduce dropshadow effect for opengl renderer
issue: https://github.com/thorvg/thorvg/issues/3054
2025-04-15 11:43:32 +09:00
Benjamin
b38b6b659d common: fix incorrect aabb of scenes 2025-04-10 12:31:28 +09:00
Sergii Liebodkin
eb67549295 gl_engine: Introduce tritone effect for opengl renderer
issue: https://github.com/thorvg/thorvg/issues/3054
2025-04-10 11:36:47 +09:00
Sergii Liebodkin
95f1b84a56 gl_engine: Introduce tint effect for opengl renderer
issue: https://github.com/thorvg/thorvg/issues/3054
2025-04-10 11:36:47 +09:00
Sergii Liebodkin
85e215a294 gl_engine: Introduce fill effect for opengl renderer
issue: https://github.com/thorvg/thorvg/issues/3054
2025-04-10 11:36:47 +09:00
Sergii Liebodkin
595769257e gl_engine: Introduce gaussian blur effect
issue: https://github.com/thorvg/thorvg/issues/3054
2025-04-09 11:16:55 +09:00
Hermet Park
e002d68338 Revert "gl_engine: Introduce gauss blur effect for opengl renderer"
This reverts commit 131c194124.

note: Lottie animation is broken
2025-03-28 00:28:27 +09:00
Sergii Liebodkin
131c194124 gl_engine: Introduce gauss blur effect for opengl renderer
issue: https://github.com/thorvg/thorvg/issues/3054
2025-03-27 22:51:02 +09:00
Hermet Park
afd780bfa9 wg_engine: set default file permissions 644 for consistency 2025-03-27 22:19:36 +09:00
Hermet Park
bd520c1c69 ttf: ++thread safety
Properly allow the ttf loader sharable among threads.

issue: https://github.com/thorvg/thorvg/issues/3165
2025-03-25 17:02:58 +09:00
Hermet Park
756f866d54 renderer: safety++
introduced a threshold for the minimum dash size
to prevent excessive fragmentation.

issue: https://github.com/thorvg/thorvg/issues/3332
2025-03-24 23:50:57 +09:00
Hermet Park
be0cbc356a 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-03-24 22:22:13 +09:00
Hermet Park
56d5396b7a common: ++loader thread safety
fortitfy the thread safety
in multi-threaded resource loading.

issue: https://github.com/thorvg/thorvg/issues/3306
2025-03-24 18:18:30 +09:00
Sergii Liebodkin
a1ca566c48 gl_engine: luma visual differneces fix
https://github.com/thorvg/thorvg/issues/3045
2025-03-21 11:03:36 +09:00
Hermet Park
eddd8961f3 common: hotfix regression bugs during recent dev
- fixed Duplicate/Text samples broken
- fixed a Lottie TextPath memory leaks
- fixed a broken SVG gaussian blur
2025-03-20 22:33:36 +09:00
Hermet Park
333e65ef7a renderer: revise the Bounding Box Behavior
- modify the concept of AABB to apply only to transformed shapes.
- transform points before computing the bounding box min/max
  to obtain a more compact shape region.
- trimmming memory by removing the cached matrix, about 36kb
  of memory has been reduced per paint instance.
2025-03-20 13:26:25 +09:00
Sergii Liebodkin
a7efd0f199 wg_engine: crash for empty clips fix
issue: https://github.com/thorvg/thorvg/issues/3289
2025-03-20 11:58:47 +09:00
Jinny You
b350e45e1e wg_engine: remove unnecessary header
The Emscripten header was previously used because the WebGPU initialization logic was in WgContext::initialize.

Now, initialization occurs at the binding/application level.
2025-03-19 18:46:07 +09:00
Hermet Park
563f8b2f78 renderer: added parent scene query api
added 2 more APIs for user convenience to allow backtracking tree traversal.

API Additions:
- const Paint* Paint::scene() const
- const Tvg_Paint* tvg_paint_get_scene(const Tvg_Paint* paint)
2025-03-19 11:19:26 +09:00
Hermet Park
f1e9ce0460 common: refactoring the dash pattern
introdced the length to avoid duplicate among engines
2025-03-17 15:28:23 +09:00
Hermet Park
36be459c80 renderer: ++wasm build portability
removed the direct thread inclusion
when those thread features are disabled
2025-03-12 13:14:13 +09:00
Hermet Park
24378cc200
gl_engine: ++neat code (#3319) 2025-03-11 19:16:58 +09:00
Hermet Park
6f9fd6ff01 sw_engine: minor refactoring
simpler logic to computes.
2025-03-11 14:31:22 +09:00
Hermet Park
852ca2a523 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-11 14:31:17 +09:00
Thaddeus Crews
e235eb8152 common: support c++20 builds 2025-03-10 09:45:19 +09:00
Hermet Park
c854a7207f wg_engine: hotfix of memory sanitizer
../src/renderer/wg_engine/tvgWgRenderer.cpp:623:78: runtime error: downcast of address 0x5040005b7010 which does not point to an object of type 'RenderEffectFill'
0x5040005b7010: note: object is of type 'tvg::RenderEffectTint'
 00 00 00 00  80 07 5d 35 c9 7f 00 00  20 60 23 00 30 50 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'tvg::RenderEffectTint'
../src/renderer/wg_engine/tvgWgRenderer.cpp:624:85: runtime error: downcast of address 0x5040005b7050 which does not point to an object of type 'RenderEffectFill'
0x5040005b7050: note: object is of type 'tvg::RenderEffectTritone'
 00 00 00 00  a0 07 5d 35 c9 7f 00 00  40 5e 23 00 30 50 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
2025-03-07 00:04:48 +09:00
Hermet Park
28d653e22f renderer: hotfix crash
addressed extra corner case errors by
9e6a514022
2025-03-06 23:46:15 +09:00
Hermet Park
9e6a514022 common: ++stability of the font cache
Use the font name as the cache key for
precise comparison instead of the file path.
2025-03-06 19:00:06 +09:00
Hermet Park
96dc3d6697 common: str refactoring
renamed the prefix to be slimmer and more compact.
2025-03-06 12:18:24 +09:00
Mira Grudzinska
f98057063b renderer: rectified the fast track for clipping
- Issue was present when masking and clipping were applied
simultaneously. In the case where the mask was in fastTrack
mode and the clip was also clipped, the fastTrack was not
reset, resulting in an incorrect rendering effect.

- For rectangular clippers with a stroke width > 0, stroke clipping
should be applied. However, the fastTrack mode was set instead,
resulting in regular clipping instead of stroke clipping.
2025-03-05 23:28:13 +09:00
Hermet Park
67098793f0 renderer: revise the paint bounding box api
C++ API Modificaiton:
 - Result Paint::bounds(float* x, float* y, float* w, float* h, bool transform = false) const
  -> Result Paint::bounds(float* x, float* y, float* w, float* h) const

C++ API Addition:
 - Result Paint::bounds(Point* pt4) const

C API Modification:
- Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, float* y, float* w, float* h, bool transformed);
 -> Tvg_Result tvg_paint_get_aabb(const Tvg_Paint* paint, float* x, float* y, float* w, float* h);

C API Addition:
- Tvg_Result tvg_paint_get_obb(const Tvg_Paint* paint, Tvg_Point* pt4);

issue: https://github.com/thorvg/thorvg/issues/3290
2025-03-05 14:46:55 +09:00
Sergii Liebodkin
259dbc9840 wg_engine: stroke clipping issue
Issue: https://github.com/thorvg/thorvg/issues/3298
2025-03-05 14:10:43 +09:00
Sergii Liebodkin
b43177639c gl_engine: introduce the stroke clipper
See Clipping example
Issue: https://github.com/thorvg/thorvg/issues/3063
2025-03-04 18:37:53 +09:00
Hermet Park
30a5f2891b renderer: improved the paint bounding box accuracy
previously, the bounding box calculation was simply
determined by comparing all the points, which led to
incorrect sizing due to Bezier control points.

Now, it accurately computes the curve boundary,
properly addressing this issue.
2025-03-04 14:37:43 +09:00
Hermet Park
82a9a05405 common: replace the strdup() with strDuplicate()
tvg expects the coherent memory allocator usage,
while strdup() is out of the control. so replaced it.
2025-02-28 12:04:53 +09:00
Sergii Liebodkin
889710ecee wg_engine: Introduce the stroke clipper
Issue: https://github.com/thorvg/thorvg/issues/3063
2025-02-28 11:34:01 +09:00
Sergii Liebodkin
173822b1d9 wg_engine: fix memory leak sanitizer report (fill effect)
Issue: https://github.com/thorvg/thorvg/issues/3292
2025-02-28 11:25:30 +09:00
Sergii Liebodkin
1f204ffb8d wg_engine: Introduce triton effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
2025-02-27 20:11:21 +09:00
Sergii Liebodkin
f024c54b87 wg_engine: Introduce tiny effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
2025-02-27 20:11:21 +09:00
Mira Grudzinska
89752ff661 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-02-27 19:04:49 +09:00
Mira Grudzinska
83eb2a0430 renderer: fix trimmed rect clippers
Rectangular clippers followed the 'fastTrack' path,
which caused their trimming to be ignored. Fixed.
2025-02-27 18:40:03 +09:00