Commit graph

1479 commits

Author SHA1 Message Date
Hermet Park
d8262dd1f8 sw_engine raster: code refactoring
--remove parameter
2021-11-10 19:39:21 +09:00
Hermet Park
f9a7df7a10 sw_engine raster: code refactoring
unify several function paramters with one structure.
2021-11-10 19:29:09 +09:00
Hermet Park
205e463160 sw_engine raster: code refactoring
keep it neat & clean code with descriptions.
2021-11-10 18:26:31 +09:00
Hermet Park
d73ecc5524 sw_engine raster: code refactoring
renamed internal variables, no logical changes.
2021-11-10 17:34:27 +09:00
Hermet Park
cffc87e7b1 sw_engine raster: code refactoring.
keep the code thorvg convention.
2021-11-10 17:03:07 +09:00
Mira Grudzinska
8c4b679fb7 sw_engine: unification of mask and inv mask functions
The function pointers used to pass the proper blending method - mask
or inverse mask.
2021-11-10 13:07:57 +09:00
Hermet Park
097e10fea4 sw_engine renderer: fix the invalid memory access in the corner case.
Tasks can be disposed while the renderer referencing it.
Now, we can delete the tasks with lazy approach by introducing some tags.

@Issue: https://github.com/Samsung/thorvg/issues/995
2021-11-09 20:38:12 +09:00
Mira Grudzinska
14c1562b36 tvg_saver: fix memory leaks
In the cae when Result::InsufficientCondition was retured by the save()
api, the user had to remember to delete the passed paint - fixed.
Also path was not released.
2021-11-09 20:15:06 +09:00
Hermet Park
6ba2bc8eb3 tvg_loader: fix asan report.
revert c31c77c0fb

memory mis-alignment is detected by asan tool.
2021-11-09 17:11:10 +09:00
Hermet Park
cbcb85cd7c sw_engine renderer: code refactoring
free the member resources in the destructor.
2021-11-09 16:09:44 +09:00
Hermet Park
4587a39f46 test capi: fix the memory leak.
target is dangled without any proper deletion...
2021-11-09 15:05:55 +09:00
Hermet Park
de353401a7 Revert "test capi: fix memory leak."
This reverts commit 651a98a2d8.

Applied the alternative solution instead of this patch.
37e39866dd
2021-11-09 14:55:54 +09:00
Hermet Park
74413a989f common paint: fix a memory leak.
delete dangling object properly in the corner case.

Unfortunately, this brings to correct the capi test cases.
we assume the paints is deleted whenever its result is successful or not.

@Issue: https://github.com/Samsung/thorvg/issues/995
2021-11-09 14:51:32 +09:00
Hermet Park
775a0bcb1d test initializer: remove a invalid test case.
This test depends on the machine environment.
it's not guaranteed the same result so we remove it.
2021-11-09 14:28:41 +09:00
Hermet Park
37e39866dd common: ++exception handling.
fix the memory leak in the corner case

detected by tvg test suites

@Issue: https://github.com/Samsung/thorvg/issues/995
2021-11-09 14:16:15 +09:00
JunsuChoi
00bba39b02 test Array: Remove too big size test
On large memory machines, if machine have enough memory,
tests failed because it doesn't return null.
2021-11-09 14:04:42 +09:00
JunsuChoi
6400493859 tvg_saver TvgSaver: Initialize local value
If paint has no path information or stroke information,
it is not referenced inside bounds.
This will access the uninitialized variable at line 759, 760.
2021-11-08 19:39:01 +09:00
Hermet Park
2aa551e222 common array: + exception handling.
properly handle if the realloc() is failed.

@Isssue: https://github.com/Samsung/thorvg/issues/995
2021-11-08 12:28:17 +09:00
Mira Grudzinska
8608238343 tests: capi - buffer was not freed 2021-11-08 12:27:23 +09:00
Hermet Park
651a98a2d8 test capi: fix memory leak.
Delete the paint which is not committed properly.
2021-11-06 01:46:42 +01:00
Hermet Park
fd74e0fae8 test: fix memory leak.
these duplicates are not unique_ptr, should be taken care.

@Issue: https://github.com/Samsung/thorvg/issues/995
2021-11-05 21:48:24 +09:00
Hermet Park
b956b0a7e0 sw_engine raster: fix build break.
trivial mistake by cdf7019b19
2021-11-05 20:59:54 +09:00
Michal Maciola
545d3ead67
WASM: unpremultiplyBuffer fixes (#999) 2021-11-05 10:32:41 +01:00
Hermet Park
45f521618c sw_engine image: ++missing logs. 2021-11-05 17:43:08 +09:00
Hermet Park
cdf7019b19 sw_raster image: add error logs to notify issues. 2021-11-05 17:42:19 +09:00
Michal Maciola
551d83add0
WASM: revert cpp_*args into properties (#998) 2021-11-05 09:40:59 +01:00
Mira Grudzinska
7bc7ab83d0 sw_engine: functions supporting a masking of the clipped images are missing
To preserve the naming convention function '_rasterTranslucentImageRle'
is reanmed to '_translucentImageRle'. The '_rasterTranslucentImageRle'
function is though created - it checks the composition method and calls
the corresponding function. Missing functions are marked, but not implemented
(separate commit).
2021-11-05 17:36:25 +09:00
Hermet Park
c790e18de6
svg_loader: reduce binary size
saved 800 bytes.
2021-11-05 17:17:20 +09:00
Hermet Park
88d34f0d9a svg_loader: reduce binary size
removed the std::string usages.

saved 17kb.
2021-11-05 17:12:53 +09:00
Mira Grudzinska
b85eaddcf2 svg_loader: passing the svgPath information into the _applyComposition
An image can be a mask, so the information about it's path is necessary
during a composition application.
2021-11-05 13:10:52 +09:00
Mira Grudzinska
0501863195 svg_loader: mask node loaded as a scene
Since the mask is a container element (in opposite to the clipPath),
it has to be loaded as a scene.
2021-11-05 13:10:52 +09:00
Mira Grudzinska
40f2baabae svg_loader: SvgCompositeNode type introduced
Clips and masks require to implement some additional variables,
so the new node type has been introduced. Implementation of the usage
of these additional variables will be the subject of a separate
commit.
2021-11-05 13:10:14 +09:00
Hermet Park
eadb7fc4af binary size optimization.
replaced new/delete with malloc/free

saved 936 bytes
2021-11-04 20:10:21 +09:00
Hermet Park
b289950a5f common shape: code refactoring.
cast to float type properly.
2021-11-04 17:35:30 +09:00
Michal Maciola
f222124c40 WASM: Use ARGB8888. Convert into ABGR and unmultiply after sync()
Wasm needs ABGR STRAIGHT buffer.
As there is a problem using ABGR for loaders, it is better to use ARGB8888.
This patch makes wasm using ARGB8888 and relocate pixels and unmultiply after sync().
2021-11-04 17:12:05 +09:00
Hermet Park
c3a29bd648 common math: code refactoring
introduce common math functions to improve the reusability.
2021-11-04 17:11:27 +09:00
Hermet Park
7c1b16ba11 common shape: ++tiny optimization
reduce the binary size by 80 bytes.
2021-11-03 20:24:36 +09:00
Hermet Park
b705822732 optimize binary size.
apply two more compiler options to reduce binary size.

Saved about 7kb.
2021-11-03 20:04:12 +09:00
Hermet Park
9f914d596e doc: added capi documentation. 2021-11-02 21:10:46 +09:00
Hermet Park
04a27f383e doc: added c api documentation 2021-11-02 21:08:36 +09:00
Hermet Park
f85a9eb136 doc: up to date v0.6.0 2021-11-02 21:02:07 +09:00
Hermet Park
6f42007f29 infra: just released v0.6.0 2021-11-02 20:06:06 +09:00
Hermet Park
4d62108d81 update wasm build script
remove the deprecations and warnings.
2021-11-02 19:53:08 +09:00
Hermet Park
0f2d7e3eef jpg_loader: fix compiler warnings.
"warning: shifting a negative signed value is undefined [-Wshift-negative-value"
2021-11-02 19:49:57 +09:00
Hermet Park
c31c77c0fb tvg_loader interpreter: tiny optmization
skip memory copy as possible.
2021-11-02 19:47:08 +09:00
Mira Grudzinska
6b132d77e8 tvg_saver/tvg_loader: gradient fill in the tvg format
Introducing the gradient transform() apis and changing the grad
algorithms made it possible to apply the shape's transformation
before saving the tvg file, in case the shape (or its stroke)
has a fill.
2021-11-02 19:37:02 +09:00
Hermet Park
3b54e4797e sw_engine image: fix memory leak.
reset rle is supposed to be reused, image should keep its pointer.

@Issue: https://github.com/Samsung/thorvg/issues/982
2021-11-02 19:33:32 +09:00
Mira Grudzinska
7176a5ddd4 svg_loader: define the scaling factors for units changing
The values in absolute units are calculated based on the pixel unit.
Till now the default value of 90dpi was used. Since CSS3 (now CSS4 is
the most recent) 1 inch equals to 96 pixels. The necessary constants
are introduces in this commit.
2021-11-02 11:29:41 +01:00
Hermet Park
3c7d037841 jpg_loader: code refactoring
removed unused variables.
2021-11-02 19:02:07 +09:00
Hermet Park
c8e7bc9d43 png_loader: code refactoring
removed unused variables.
2021-11-02 18:57:55 +09:00