The API allows now values <= 0 for dashes and gaps. Negative values
are treated as zero. The exception is when all provided values
are <= 0, in which case the dash is ignored.
This fixes the issue when dash = 0 was provided for strokes with round
or butt caps - the dot was not drawn, even though it should have been.
docs: the strokeDash API behavior's clarification for odd numbers
of values in dashPattern and refinement of the accepted values.
The differences resulted from discrepancies between
the engines in applying equality or inequality signs
and in using different precision levels when determining
the dash remainder when transitioning to a new path
command.
@Issue: https://github.com/thorvg/thorvg/issues/3265
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
The sw_engine, when determining the outline, converts
floats to ints by multiplying them x64, resulting in
a comparison precision of 1/64 = 0.015625.
Both gl_engine and wg_engine operate on floats. Before
adding a closing point to a shape, they performed a comparison
to check if the point differed from the starting point:
- wg: with a precision of 1e-3 (using length2, i.e., eps = 1e-6
- gl: used direct == comparison.
Now, consistency has been ensured by introducing a comparison
precision of 1/64 in both wg_engine and gl_engine.
@issue: https://github.com/thorvg/thorvg/issues/2799
@issue: https://github.com/thorvg/thorvg/issues/3235
Manage the global buffer memory for vertex and indexed vertex buffers,
increase the memory size incrementally twice by default and reduce
the default buffer size, which is not suitable for typical scenarios.
This could reduce the a bit stack memory usage and improve
the portability across systems where has the stack memory
limitation and potentially gaining performance enhancement
by avoiding brutal stack memory usage at the many function calls.
added the internal functions:
- WgVertexBuffer* mpoolReqVertexBuffer(float scale = 1.0f);
- WgIndexedVertexBuffer* mpoolReqIndexedVertexBuffer(float scale = 1.0f);
- void mpoolRetVertexBuffer(WgVertexBuffer* buffer);
- void mpoolRetIndexedVertexBuffer(WgIndexedVertexBuffer* buffer);
issue: https://github.com/thorvg/thorvg/issues/3159
For an odd number of dash/gap segments, the offset was
handled incorrectly because the non-doubled count of
dashes and gaps was used.
Additionally, in ddcbbf7, an error was introduced by
overlooking the fact that the offset can shift the dash
pattern in such a way that the first segment of the dashed
line becomes a gap.
In cases where the distance between points is 0, further
processing of the points results in division by zero.
To avoid this check, we ensure that duplicate points are
not added during trimming.
Streaming model for massive vertex and index creations: minimize memory allocations, range checks and other conditions
Reduce number of segments length calculations (sqrt) and bbox (min and max).
Update distances and bboxes on a whole buffer and only if necessary. For shapes without strokes compute distances not necessary at all. bbox can be updated only on the final stage of geometry workflow, but not on the each stage.
Using stack memory instead of heap. its more cache friendly and did not fragment memory, faster memory allocations (weak place of realization)
Using cache for points distances and whole path length. Updates only if necessary
Validation of geometry consistency executes only on the final stage of path life cicle. It more friendly for data streaming: no any conditions and branches.
Using binary search for strokes trimming
Pre-cached circles geometry for caps and joints
Refactored strokes elements generation functions. Code is more readable and modifiable in general. Can be easily fixed if some geometry issues will be finded
Fixed detection of close vertices using comparison with epsilon and related artifacts in stencil buffer as extra pixels.
Fixed incorrect tessellation of curves using scaling.
Spec out this incomplete experimental feature,
this is a still promising one, we will reintroduce
this officially after 1.0 release
size: -2kb
issue: https://github.com/thorvg/thorvg/issues/1372
* bind groups creation in real time removed - performance boost
* blend and composition shaders decomposed - performance boost
* shader modules and pipeline layouts generalized - less memory usage
* shared single stencil buffer used - less memory usage
* bind groups usage simplified
* general context API simplified and generalized
* all rendering logic moved into new composition class
* ready for hardware MSAA (in next steps)
* ready for direct mask applience (in next steps)
Shapes were incorrectly closed in certain cases -
the decision to close a shape or not should be based on
path commands rather than the number of points and
their distances from each other.
[issues 1479: lottie](#1479)
- optimaze stroking algorithm by prevent vector normalizations
- using render meshes heaps to reduce webgpu instances re-creations
- using single instance of pilylines for standard operations such as trim and split
- "on-the-fly" strokes generations with dash pattern
- "on-the-fly" mesh objects generation in a process of path decoding
- merge strokes into single mesh by each shape
[issues 1479: FillRule](#1479)
Introduced fill rule winding
This rule makes sense only if path have some self intersections.
In all other cases shapes are filled by even-odd behavor.
Before the current changes, all surfaces were painted using a full-screen overlay, no matter how large the object was rendered. This approach is redundant and required reorganization. At the moment, all objects are rendered using an overlay equal to the box of the object itself, which reduces the cost of filling the surface.
Also surfaces and images were divided into different entities, which reduces the pressure on memory.
Also geometry data for rendering and geometry data for calculations in system memory were logically separated.