Commit graph

493 commits

Author SHA1 Message Date
Hermet Park
8c3e40472c renderer: fixed a wrong fillrule option
- fixed to use the default option NonZero fillrule.
- updated the doc about text font as well
2025-07-22 16:11:51 +02:00
Mira Grudzinska
cacd7d442a renderer: fix render region for multiple masks
Previously, when more than two masks were applied,
the render region only took the first added mask into
account.

@Issue: https://github.com/thorvg/thorvg/issues/3600
2025-07-22 16:11:51 +02:00
Hermet Park
5d12df7aa0 sw_engine: dropshadow stability++
removed the direct rendering optimization of the dropshadow,
because it's a buggy.
2025-07-22 16:11:51 +02:00
Mira Grudzinska
68f01c85fa sw_engine: fix focal point clamping
This approach should be introduced in d8ebd8b4f5.
Using FLOAT_EPSILON is not sufficient due to numerical precision,
since it's later inverted, and its very small value leads to
significant errors during inversion.
2025-07-22 12:46:33 +02:00
Mira Grudzinska
0c9a1d3f07 sw_engine: clamp focal point to the edge
If the radial gradient's focal point lies outside
the end circle, it's projected onto the edge.
A slight inward offset is applied to avoid numerical
issues.

Note:
Focal point support in the sw and wg engines is
consistent with the SVG 1.1 standard, whereas the gl
engine aligns with the SVG 2.0 standard.
2025-07-22 12:46:33 +02:00
Mira Grudzinska
3862fa802f avx/neon: remove double increment of the value
The span was incremented both in the for loop instruction
(ARRAY_FOREACH) and inside the loop body. Fixed.

@Issue: https://github.com/thorvg/thorvg/issues/3547
2025-07-22 12:46:33 +02:00
Hermet Park
8b864c0c23 gl_engine: ++safety 2025-07-22 12:46:33 +02:00
Hermet Park
3889ffe8ec engines: manage the update with the precise update flags
this also fixes one broken clipping issue.

issue: https://github.com/thorvg/thorvg/issues/3448
2025-07-22 12:46:28 +02:00
Hermet Park
d33a3e53f5 renderer: precise condition check for skip compositions
single child picture would not also requre composition in a scene
2025-07-21 21:26:20 +02:00
Hermet Park
d9960203b0 sw_engine: revised the texture clipping
previous logic doesn't work if the clipping shape
has any inner corners. replace the logic
with a intermediate composition approach for
stability.

- performance can be drop at texture clipping by ~11%
- size is reduced by -0.5kb

issue: https://github.com/thorvg/thorvg/issues/3520
2025-07-21 20:16:44 +02:00
Hermet Park
b1bfd22487 renderer: chores++ 2025-07-21 14:30:41 +02:00
Hermet Park
e0d4ab2f68 renderer: increased the reference count capacity
255 is enough size in general but a bit limited.
2025-07-21 14:29:45 +02:00
Hermet Park
16d3ff75dc sw_engine: skip AA if texture are orthogonally rotated.
there is no necessary applying AA for 0/90/180/270 degree rotation

issue: https://github.com/thorvg/thorvg/issues/3452
2025-07-21 14:26:40 +02:00
Sergii Liebodkin
bd2ee236e7 gl_engine: fix compilation warning with RenderRegion data type 2025-07-21 14:26:30 +02:00
Mira Grudzinska
031dd647bc 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-24 01:37:24 +09:00
Hermet Park
bb6458b50a sw_engine: fixed a a regression bug during main dev
borker by 14130e7e72afaecff2dd091e5e272169c79515b9
2025-05-24 01:37:24 +09:00
Hermet Park
1b37743b2c 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-05-24 01:37:24 +09: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
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
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
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
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
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
782f067b22 renderer: hotfix a null memory copy 2025-01-30 21:09:27 +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
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
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
949c918af9 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-16 18:29:31 +01:00
Hermet Park
3831a90a7d sw_engine: corrected blendings
corrected wrong ColorDodge, ColorBurn, Exclusion, SoftLight blendings

issue: https://github.com/thorvg/thorvg/issues/3072
2025-01-16 18:22:17 +01:00
Hermet Park
cb0691fee0 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 15:08:43 +01:00
Marcin Baszczewski
978464d87c gl_engine: Fix for rendering short paths
Ensure they do not terminate prematurely for paths
with a step of 0 or exceptionally small values
when a valid stroke-width is present.

In my opinion, the optimal approach was to separate vertex generation
into dedicated methods: strokeRoundPoint and strokeSquarePoint.

My update supports two different stroke-cap styles.
I have also tested it with various files (JSON, SVG)
as well as a small example application similar
to the one included in the previous pull request (#3066).

issue: https://github.com/thorvg/thorvg/issues/3065
2025-01-02 15:04:41 +01:00
Hermet Park
b59c7a0bee API: enable users to use an accessor to traverse Scene
remove the restriction of targeting only Picture.
now, any kind of paints can be adaptable here.
2025-01-02 14:48:30 +01:00
Marcin Baszczewski
a5f67ee92c Fix for Rendering Short Paths. 2025-01-02 13:11:21 +01:00
Hermet Park
bed521a08c common: refactored the scene effect tint
Pre-convert the data type from float to uint8_t
2025-01-02 13:10:31 +01:00