Commit graph

36 commits

Author SHA1 Message Date
Hermet Park
75ae8bcc7b sw_engine: properly update the render region
shape render region should be aligned with the
current shape bbox. this could bring the compact size
of the rendering region even shapes are not drawable.
2024-10-22 00:38:58 +09:00
Mira Grudzinska
c9c8e35476 sw_engine: increased accuracy in dashing
The limit on leftovers was too small, which became
noticeable for animations with trimming - currently
implemented with the dashing alg.
The limit has been increased.
2024-09-30 16:44:22 +09:00
Mira Grudzinska
d29a3d754b common: move&fix trimming wrapping logic
The logic of interpretation of trimming start and
end values has been moved to the sw_engine,
so the values provided by the user are not modified.
No logical changes in the interpretation alg.

For pairs of trim's start/end values where the distance
between begin and end is >= 1, the entire stroke should
be drawn, but instead, nothing or only part is drawn. Fixed.

Stroke trim docs fixed.
2024-09-30 15:48:18 +09:00
Hermet Park
ecabdc5ebc renderer: code refactoring
Replaced the transformation with
a strong associated data field.

This helps to reduce the binary size (-1k).
2024-09-30 15:39:52 +09:00
Hermet Park
4f58124754 common/math: code refactoring
- migrate tvgLine to tvgMath
- associate line functions with classes.
2024-09-30 15:22:46 +09:00
Hermet Park
c9d1df3957 common/math: code refactoring
Replaced the prefix "math" with "tvg" namespace.
2024-09-30 15:22:38 +09:00
Mira Grudzinska
b95fa3a7bd sw_engine: fix fastTrack condition
When checking the fastTrack condition,
it's necessary to exclude the outlines
with a Bezier curve (Move-Cubic-Line,
Move-Cubic-Close, Move-Line-Cubic).

@Issue: https://github.com/thorvg/thorvg/issues/2379
2024-06-24 14:43:54 +09:00
Mira Grudzinska
f0b0ea3edb sw_engine: fix trimming
For the 'simultaneous' trimming option, the maximum
stroke length from all subpaths was determined and
used to scale the trim of each subpath. As a result,
if the subpaths had different lengths, this scaling
was incorrect.
Now, the length is determined separately for each
subpath and is used to scale the trimming of its stroke.

@Issue: https://github.com/thorvg/thorvg/issues/2335
2024-06-24 14:42:25 +09:00
Mira Grudzinska
e6f4b5a2a8 common: strokeTrim api introduced
New api sets/gets the trim of the stroke
along the defined path segment, allowing
control over which part of the stroke is
visible.

@issue: https://github.com/thorvg/thorvg/issues/2190
2024-06-24 14:37:53 +09:00
Mira Grudzinska
c88d6cbdf3 sw_engine: fix dashing
Fixing the problem with handling a specific
case where the length of the remaining line
to be drawn and the dash line length were
exactly the same
2024-06-24 14:36:29 +09:00
Hermet Park
0e6fa01ac9 math: introduced a custom floating epsilon
Rather than aiming for extremely high accuracy,
a compromise can achieve with better performance.

This modification helps prevent unnecessary image rotation.

issue: https://github.com/thorvg/thorvg/issues/2265
2024-06-24 14:31:01 +09:00
Mira Grudzinska
179e2eb218 sw_engine: fix max length of trimmed strokes
The error was visible when multiple shapes were
simultaneously trimmed. The length of a single
shape was zeroed out only in selected cases,
which caused accumulation that could lead to
incorrect extension of the variable determining
the maximum length.

@issue: https://github.com/thorvg/thorvg/issues/2173
2024-06-24 12:18:32 +09:00
Hermet Park
043b14d681 sw_engine/stroke: hotfix the memory access violation
ensure that the number of contour/close data is properly paired.

issue: https://github.com/thorvg/thorvg/issues/2129
2024-04-06 12:48:30 +09:00
Hermet Park
6688f03396 sw_engine: revised the trimpath dash line logic
Support the TrimPath modes (individual/simultaneous)
internally in the engine to handle them efficiently.
2024-04-06 12:48:30 +09:00
Hermet Park
e4f7fffacc sw_engine: hotfix a regression bug of line drawing.
fixed one more corner case problem, just observed.
it's a side effect by 925009c4a5
2024-04-06 12:48:30 +09:00
Hermet Park
68e4d35f7b sw_engine: stabilize the contour composition logic.
there has been a logical error that breaks the contour
composition context. This fixes it.

issue: https://github.com/thorvg/thorvg/issues/2093
2024-04-06 12:08:23 +09:00
Hermet Park
051969c61c sw_engine: rectify consecutive line drawings.
There are differences in behavior compared to the SVG spec,
especially when consecutive line drawings occur without a moveTo command
following a closePath command.

Actually, thorvg didn't care the behavior in that scenario,
this update ensures the scenario is handled correctly
to align with the SVG specification.

issue: https://github.com/thorvg/thorvg/issues/1487
2024-04-06 12:08:23 +09:00
Vincent Torri
2f196b514f [common] code clean up
use fmodf() instead of fmod()
2024-04-06 12:08:23 +09:00
Mira Grudzinska
203d892cbd sw_engine: fix a regression bug
After introducing the length measurement
of approximate and exact Bezier curves in
a8c0030d80
the calculation of the outline length still
used the approximate functions, while further
calculations took the exact value into account.
This discrepancy led to the creation of artifacts.

@Issue: https://github.com/thorvg/thorvg/issues/2021
2024-04-06 12:08:21 +09:00
Hermet Park
c08c11db7d common: code refactoring
refactor common code to consolidate Bezier and line
function implementations into a single location.
2024-04-06 12:08:21 +09:00
Hermet Park
71c636e33c Revert "Revert "sw_engine: Increasing accuracy for dashed curves""
This reverts commit e49f9125b2.
2024-04-06 12:08:21 +09:00
Hermet Park
c01c8338d7 Revert "sw_engine: Increasing accuracy for dashed curves"
This reverts commit a8c0030d80.
2024-04-06 12:08:21 +09:00
Mira Grudzinska
d399ae922a sw_engine: Increasing accuracy for dashed curves
Dashed curves require greater precision in calculating
their lengths and while splitting Bezier curves.
Otherwise, it results in visual discrepancies compared
to the expected outcomes.
Approximate functions 'bezLengthApprox' and 'bezAtApprox'
used for calculations in the lottie loader.

issue: https://github.com/thorvg/thorvg/issues/1686
2024-04-06 12:08:21 +09:00
Hermet Park
d0cc5a1465 sw_engine: Address a corner case in trim path handling
This update fixes an issue where duplicated overlapping curves/lines,
when introduced as a single line.
That case overlapping command operation is take account for
the trim path's path-building process.

We now skip such cases to ensure the trim path functions correctly.

issue: https://github.com/thorvg/thorvg/issues/1939
2024-04-05 17:39:24 +09:00
Hermet Park
5bdb585534 sw_engine: Rectified dash line drawing issue.
Omit the dash line when its length falls below a minimal threshold.
This threshold is set to less than 0.0001 times the pixel size.
2024-04-05 17:37:55 +09:00
Hermet Park
780f30bfcc sw_engine: removed redundant logic.
Basically, sw_engine uses a desinated memory pool,
this reservation is not so effective.
2024-04-05 17:28:27 +09:00
Jinny You
92288c8291 updated copyright date (#1866) 2024-01-02 20:34:12 +09:00
Hermet Park
39022851b7 sw_engine: ++null safety 2023-12-26 18:23:54 +09:00
Hermet Park
0a9d98ccfd sw_engine/stroke: enhanced the quality of the dash line corners.
Previously, the engine didn't properly cover the dash line corner styles
because it considered a new line to start at the corner.

This update modifies the logic to recognize curved lines
as a single line, including the corners.

There may still be some quality issues,
but it's an improvement over the previous version.

@Issue: https://github.com/thorvg/thorvg/issues/121
2023-12-26 17:47:32 +09:00
Hermet Park
edb156f4fc sw_engine/shape: fix a dash-line infite-loop bug.
a regresion bug was introduced by d683d2e70d
2023-09-21 21:55:53 +09:00
Hermet Park
d683d2e70d sw_engine: Do not handle exceptions for zero line length.
While it may represent a dot with a stroke width,
ignoring its length is not a good idea.

this also eliminates 0 size dash dots caused by unexpected empty lengths.
2023-09-15 11:16:38 +09:00
Hermet Park
78cb32794a sw_engine: utilize the memory pool for dash stroking. 2023-09-05 12:38:57 +09:00
Hermet Park
ad9d9d0ecd loader/lottie: support trimpath feature 2023-09-01 13:16:18 +09:00
Hermet Park
992891e6a8 sw_engine: a minor optimization.
reduced the point counting since we already know some of them.
2023-08-29 13:24:54 +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/tvgSwShape.cpp (Browse further)