Commit graph

2857 commits

Author SHA1 Message Date
Mira Grudzinska
c6bd09648c examples: ensure the file is closed
In case of an error during memory allocation
for file data, the file was not closed.
2024-06-17 11:45:25 +09:00
Mira Grudzinska
6518f2e442 common: force the use of ttf loader for font data
Providing an incorrect mimetype or not specifying one
was not handled and resulted in data not being loaded
when loading the font from memory.
Now, the use of the TTF loader is enforced regardless
of the provided mimetype.
2024-06-17 11:45:25 +09:00
Mira Grudzinska
6544747e70 common: fix returned value
In the case of requesting to unload a font that
has not been previously loaded, InsufficientCondition
should be returned, not InvalidArgument.
2024-06-17 11:45:25 +09:00
Sergii Liebodkin
184343f6f2 wg_engine: fix composition math
Fix AlphaMask, InvAlphaMask, LumaMask and InvLumaMask math
Fix double apllience of opacity value
2024-06-17 11:44:13 +09:00
Sergii Liebodkin
f333241f0a wg_engine: fix fill rule usage
Fix wronk application of fill rule in a cases of terminated path (.close()/.moveTo())
2024-06-17 11:43:40 +09:00
Sergii Liebodkin
419fa93989 wg_engine: fix strokes failers and visual atrifacts
Ignoring rezo-width strokes, single point strokes.
Fix visual artifacts in case of mitter joints.
2024-06-17 11:42:51 +09:00
Hermet Park
43464ceba4 infra: build wg canvas properly. 2024-06-16 18:29:36 +09:00
Hermet Park
dbde6393a9 renderer/canvas: clean up code
pimpl is not used at all.
2024-06-16 18:23:15 +09:00
Mira Grudzinska
c4781545c9 capi: remove the incorrectly named API
There was a typo in the name (tvg_canvas_est_viewport),
which made it seem like it was missing. The correctly
named API has already been added, so this one can be
removed.
2024-06-15 23:12:04 +09:00
Hermet Park
51c2e66f51 sw_engine: fix a crash issue.
set the anti-aliasing frame info properly, in an exceptional case.

issue: https://github.com/thorvg/thorvg/issues/2391
2024-06-14 10:40:56 +09:00
Hermet Park
1099c65fe7 sw_engine: fix a missing anti-aliasing
enable fill anti-aliasing when the stroke is trimming.
2024-06-14 09:57:12 +09:00
Hermet Park
de693c3e3e infra: relocate the tools folder.
Collect only library source code in src
2024-06-13 17:52:14 +09:00
Hermet Park
3f38f661be examples: ++ function name alignment 2024-06-13 14:44:55 +09:00
Hermet Park
5e6df3334b infra: ++wg_native package dependency
Windows might need a own library linking method.
2024-06-13 14:44:55 +09:00
Sergii Liebodkin
a7f4d718f4 wg_engine: fix model view matrix
In a case of compostions model view matrix did not apply samples count
2024-06-13 10:46:36 +09:00
Sergii Liebodkin
9f08e4755c wg_engine: clear bbox mesh lists
when cleaning the geometry of an object, it is also necessary to clean the bounding boxes and store them in the pool
2024-06-13 10:46:36 +09:00
Hermet Park
45bf996a19 doc: updated the WgCanvas api doc 2024-06-12 12:45:47 +09:00
Sergii Liebodkin
7e493f91f2
wg_engine: cross-platform support
it provide changes public API for webgpu canvas interface to provide nessessary handles to native window for different platforms:

API Change:
- Result target(void *instance, void *surface, uint32_t w, uint32_t h) noexcept;
2024-06-12 12:39:37 +09:00
Mira Grudzinska
50d1d2fd36 example: load font from memory in Text.cpp 2024-06-11 20:59:39 +09:00
Mira Grudzinska
d8a720fb7e ttf_loader: support loading from memory
New text API for loading fonts from memory
is introduced. This is necessary to enable
embedded fonts support.
2024-06-11 20:59:39 +09:00
RuiwenTang
f8626d13d1 gl_engine: fix clip path and bounds not correct
* Optimize clip logical, change to use GL_GRATER and keep incrace depth
  value, so no need to do depth clear after every clip draw.
* Correct geometry bounding box calculation, and make sure the bounds is
  larger than all vertices
* Limit drawing area for off-screen RenderPass with correct scissor box
2024-06-11 20:57:07 +09:00
Hermet Park
d9294471a6 wg_engine: resolve gcc compiler warnings.
virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
2024-06-11 20:54:56 +09:00
Hermet Park
97ee9edaa2 wg_engine: add the wgpu_native library dependency.
about the wgpu-native please visit:
https://github.com/gfx-rs/wgpu-native/releases
2024-06-11 20:54:56 +09:00
Hermet Park
f1f116a5d7 Update README.md 2024-06-11 17:31:22 +09:00
Hermet Park
0563f12997 Update README.md 2024-06-11 17:31:00 +09:00
Hermet Park
e51dfb068a common: fix a crash on CI windows test.
it's a vs2022 17.10 stl known issue.
https://github.com/microsoft/STL/wiki/Changelog
2024-06-10 23:57:41 +09:00
Mira Grudzinska
8afb7f7ca8 svg_loader: handle text node
The text node is handled, but default values
of the font-family and font-size as used in
the user's system are not.
For now font has to be loaded by the user.

@Issue: https://github.com/thorvg/thorvg/issues/2350
2024-06-10 13:27:14 +02:00
Hermet Park
7b5de2fdb3 renderer: optimize the ClipPath fast-track.
this optimization applies when the clipper is
not an axis-aligned rectangle under the following conditions:

a. Coverage where the clipper is a regional superset of the viewport.
b. Coverage where the clipper is completely outside of the viewport.

issue: https://github.com/thorvg/thorvg/issues/2332
2024-06-10 11:18:53 +09:00
Hermet Park
fc754f3f6b renderer: code clean up 2024-06-10 11:18:53 +09:00
Hermet Park
1b9e6ef5a2 common/math: added minor math functions. 2024-06-10 11:18:53 +09:00
Hermet Park
bda93d99d9
Update CONTRIBUTING.md 2024-06-10 11:02:28 +09:00
Mira Grudzinska
45f73fd627 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-10 10:55:00 +09:00
Mira Grudzinska
10cdfff20d docs: resolve doxygen warnings 2024-06-09 12:01:54 +09:00
Hermet Park
0cd256f99c test: resolve compiler warnings on msvc.
warning C4305: 'argument': truncation from 'double' to 'float'
2024-06-07 23:56:30 +09:00
Hermet Park
2abfa98bae examples: fix memory leak 2024-06-07 23:56:12 +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
ade5eb2e8d api: corrected return type.
NonSupport indicates unsupported options due to disabled features
or lack of system support. InvalidArgument indicates the case
such as incorrect parameter values.
2024-06-05 23:03:05 +09:00
Jinny You
e346cbb5ca lottie: Add exception for lottie doesn't have exported glyph
Added handling logic for missing characters to prevent program hang.
2024-06-05 14:43:28 +02:00
Mira Grudzinska
07e386007c 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-05 20:16:44 +09:00
Jinny You
97a1aa136a lottie: Fix invalid font match
When Lottie has similar font names, it incorrectly matches fonts due to a logic bug.

This error causes an infinite loop when searching for glyphs.
2024-06-05 12:38:20 +09:00
Mira Grudzinska
91187cd963
common: clarification of returned types
The functions setting stroke's features always
returned a true. Returnig a boolen was a remnant
from a previous implementation. Since now they
never return false, they can be void functions.
The APIs description has been corrected.
2024-06-05 12:36:37 +09:00
Mira Grudzinska
669b5badf4 test: add strokeTrim tests 2024-06-05 11:55:36 +09:00
Mira Grudzinska
566b327f09 capi: bindings for strokeTrim
Example Capi.cpp modyfied.
2024-06-05 11:55:36 +09:00
Mira Grudzinska
e868e6e343 examples: add StrokeTrim example 2024-06-05 11:55:36 +09:00
Mira Grudzinska
33f5ea34c0 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-05 11:55:36 +09:00
Mira Grudzinska
ca92d4a53b lottie: fix matte layer finding
Layer identifiers do not have to be unique within
the entire file - they are unique within a given
group. Searching the entire composition to find
the referenced matte was an incorrect approach.

Error introduced by 1ee79a6c2a

@Issue: https://github.com/thorvg/thorvg/issues/2349
2024-06-04 15:27:44 +03:00
RuiwenTang
7c687816c2 gl_engine: fix gradient color interpretation error
Fix when gradient position is same as some starting or ending point
of a gradient stop, the output color is blank
2024-06-04 19:37:39 +09:00
Sergii Liebodkin
a2ea964be1 wg_engine: fix color buffer corruption with wgpu-opengl wrapper (linux)
In a case of usage stencil buffer only we need to turn off an color target writes. In other case color buffer fill be filled by unxepcted color if fragment shader did not return any value.
It happens in a case on OpenGL realization of webgpu, that used in linux

Befire:

After:
2024-06-04 15:22:32 +09:00