Commit graph

34 commits

Author SHA1 Message Date
Hermet Park
6fd7b87754 sw_engine: clean code++
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
2025-06-03 00:58:29 +09:00
Hermet Park
eeebfbb654 sw_engine: hotfix++
resolved a memory violation introduced by:
e2909dd6a4
2025-06-02 22:40:43 +09:00
Hermet Park
e2909dd6a4 sw_engine: replace RLE memory with common array
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
This commit has two purposes:

- refactoring to introduce y indexing method for the upcoming partial rendering.
- replaces the RLE-specific memory allocation with a shared array structure,
eliminating potential memory overflows during RLE clipping.
2025-05-28 23:17:18 +09:00
Hermet Park
dc8c5bce50 sw_engine: code refactoring
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
just renamed internal variables (region -> bbox)
for the sake of a shorter name, no logical changes.
2025-05-28 11:41:52 +09:00
Hermet Park
cc72eda465 sw_engine: unify RenderRegion and SwBBox
refactored for smoother data flow through the rendering pipeline.
2025-05-28 11:41:52 +09:00
Hermet Park
32c38041db sw_engine: added diagnostics for potential issues
Some checks failed
Android / build_x86_64 (push) Has been cancelled
Android / build_aarch64 (push) Has been cancelled
iOS / build_x86_64 (push) Has been cancelled
iOS / build_arm64 (push) Has been cancelled
macOS / build (push) Has been cancelled
macOS / compact_test (push) Has been cancelled
macOS / unit_test (push) Has been cancelled
Ubuntu / build (push) Has been cancelled
Ubuntu / compact_test (push) Has been cancelled
Ubuntu / unit_test (push) Has been cancelled
Windows / build (push) Has been cancelled
Windows / compact_test (push) Has been cancelled
Windows / unit_test (push) Has been cancelled
2025-05-22 16:12:42 +09:00
Mira Grudzinska
1b72113fcc 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-22 16:03:04 +09:00
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
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
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
Hermet Park
b77f3ca024 common: introduced designated memory allocators
Support the bindings to be more integrable with a system's coherent memory management.

Pleaes note that thorvg now only allow the desinated memory allocators here:
malloc -> tvg::malloc
calloc -> tvg::calloc
realloc -> tvg::realloc
free -> tvg::free

issue: https://github.com/thorvg/thorvg/issues/2652
2025-02-18 17:20:31 +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
Hermet Park
a12accbc93 updated copyright 2025-01-03 14:32:31 +09:00
Mira Grudzinska
acc614ab2f sw_engine: prevent warning
Remove unused version of SUBPIXELS().
2025-01-03 10:24:46 +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
Hermet Park
01f4d6304a sw_engine: fixed a rendering bug when the invalid clipper is applied.
Shapes with boundaries outside the rendering area are ignored as non-visible.
The issue arises when such a shape serves as a clipper.
The expected behavior is for the entire clipee to be cut out,
but previously, the clipee remained fully visible as if no clip was applied.

The fix identifies these clippers and skips rendering clipees.

Please note that we can skip rendering at the Paint update stage
if the clipper's viewport is outside the canvas.
This optimization can improve performance, but only for this specific case.
The downside of the approach is that it disrupts multi-processing for clipper updates.
As a result, that approach was discarded.

issue: https://github.com/thorvg/thorvg/issues/3003
issue: https://github.com/thorvg/thorvg/issues/2684

Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>
2024-12-14 01:30:56 +09:00
Dragoș Tiselice
8a5710b3c5 sw_engine: replaced longjmp with returns
Since longjmp is not yet fully supported on Wasm (emscripten uses
JS to make the jumps and requires slow jumps), but also because
longjmp is hard to reason about, this patch replaces it with
return values. The logic stays exactly the same.
2024-12-03 20:27:41 +09:00
Mira Grudzinska
0a677396c4 sw_engine: split long lines to avoid overflow
@Issue: https://github.com/thorvg/thorvg/issues/2651
2024-10-10 14:21:13 +09:00
Mira Grudzinska
19d3eb95e2 sw_engine: ++exception handling
Prevent the infinite loop in the worst case

@Issue: https://github.com/thorvg/thorvg/issues/2651
2024-10-03 23:59:18 +09:00
Hermet Park
b868503033 sw_engine: ++stability
cut the Bezier curve based on the number of points
and transform it into a straight line when it's very small.

issue: https://github.com/thorvg/thorvg/issues/2759
2024-10-03 18:54:14 +09:00
Hermet Park
b0683a26ec api: Introduced Paint::clip() API
Separate clip function from the Composite()
clipping and composition can be used together.

This helps avoid the introduction of nested scenes
when composition and clipping overlap.

Deprecated:
- enum class CompositeMethod::ClipPath
- enum Tvg_Composite_Method::TVG_COMPOSITE_METHOD_CLIP_PATH

Experimental API:
- Result Paint::clip(std::unique_ptr<Paint> clipper)
- Tvg_Result tvg_paint_set_clip(Tvg_Paint* paint, Tvg_Paint* clipper)

Issue: https://github.com/thorvg/thorvg/issues/1496
2024-09-19 14:46:05 +09:00
Hermet Park
407fc84796 common: spec out Scene Clipper
Scene Clipper is an unusual feature
that is too unstable and ambiguous in ThorVG.

Users can achieve the same functionality
with multiple composed shapes instead of scene clipping.

size: -2.5kb

issues:
- https://github.com/thorvg/thorvg/issues/1548
- https://github.com/thorvg/thorvg/issues/1549
- https://github.com/thorvg/thorvg/issues/1573
2024-08-13 10:21:54 +09:00
Hermet Park
837cf32bcb sw_engine: code refactoring.
just renamed internal name shorter.
2024-07-10 18:35:20 +09:00
Hermet Park
065a8f5eb3 sw_engine: ++rle optimization
Reduction memory copy by pushing span data into rle immediately.
2024-07-10 18:35:20 +09:00
Josh Soref
e061fa6628
common: fix 178+ spelling errors 2024-07-01 21:58:46 +09:00
Hermet Park
c4d09160e4 Revert "sw_engine: revert the threshold."
This reverts commit dad797445b.

Misidentified the key issue. It will be reviewed again.
2024-06-07 12:23:35 +09:00
Hermet Park
dad797445b sw_engine: revert the threshold.
Somehow, it breaks the window unit-test, revert the value.

regression by: 51a2936b28
2024-06-07 12:08:28 +09:00
Hermet Park
51a2936b28 sw_engine: fine-tuning RLE performance.
the arranged value is examined with the local test,
improved the speed twice for a corner-case that
extreamly huge size shape.
2024-06-07 10:38:08 +09:00
Hermet Park
043b6b9f4f common/array: code refactoring
Make the array interface pair begin()/end() for consistency.
2024-02-19 19:09:30 +09:00
Jinny You
2c6c8d3b21
updated copyright date (#1866) 2023-12-28 10:43:25 +09:00
Hermet Park
5a73bcaa8f common/array: code refactoring
easy access to a specific data with a operator.
2023-08-29 12:28:38 +09:00
Hermet Park
24711e485c infra: renames the source folders
lib -> renderer
bin -> tools
utils -> common
2023-08-28 13:11:24 +09:00
Renamed from src/lib/sw_engine/tvgSwRle.cpp (Browse further)