Commit graph

1468 commits

Author SHA1 Message Date
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
Hermet Park
e4ab100fb2 tools svg2tvg: ++exception handling.
skip to process if the input is invalid.
2021-11-02 14:38:09 +09:00
Hermet Park
3abf89a6ff examples: updated tvgs
re-compiled the tvgs with the latest tvg saver.
2021-11-02 14:32:29 +09:00
Hermet Park
4da5cbb322 infra: add tvg resource pack.
Keep v0.5 version of tvgs for checking compatibility.
2021-11-02 14:26:20 +09:00
Hermet Park
2d830eae8b infra: update meson option description 2021-11-02 13:18:17 +09:00
JunsuChoi
590381f68b infra meson: Add -Dstatic option
Add an option for use in environments where
the use of static libraries must be enforced.
2021-11-02 13:14:16 +09:00
Mira Grudzinska
abc3b40a37 sw_engine: var/funct renaming
Changed names:
shape->rect -> shape->fastTrack
_factTrack -> _axisAlignedRect
2021-11-02 11:41:14 +09:00
Mira Grudzinska
16a153c804 svg_loader: fix bounds for gradient
In the case when bounds should not include a stroke width, width
and height values were reduced by half of a stroke width, instead
of the full width.
2021-11-01 20:36:48 +01:00
Mira Grudzinska
26f99372b0 sw_engine: fastTrack with clips
After 362d2df the fastTrack cases were applied even for shapes with clips.
These changes fixed this - the check whether a shape is a rect should be done
only if it has no clips.
2021-11-01 22:21:17 +09:00
Hermet Park
3b2e1f4291 Revert "loaders: Consider colorspaces (#838)"
This reverts commit cd5116b053.

Ah this breaks the Stress example due to Picture::duplicate() is not available...

Need to consider and come back again.
2021-11-01 16:53:25 +09:00
Michal Maciola
cd5116b053
loaders: Consider colorspaces (#838)
* common: added colorSpace() function

This patch introduces colorSpace() function for SW and GL engine.

* infra: change LoadModule:read() into LoadModule:read(uint32_t colorspace)

This patch changes LoadModule:read() into LoadModule:read(uint32_t colorspace)

* picture: implement passing colorspace into loader

This patch implements passing colorspace into loaders.
Loader->read is now called on the first update.

* external_jpg_loader: support colorspaces

* external_png_loader: support colorspaces
2021-11-01 16:10:22 +09:00
Michal Maciola
479cea74cc common: Unmultiplicated colorspace
This patch introduces _STRAIGHT colorspaces (ABGR8888_STRAIGHT and
ARGB8888_STRAIGHT) whose colors are un-alpha-premultiplied. Unmultiplicated
colors are especially needed for wasm thorvg loader and svg2png / tvg2png.
Only C version now.

@issue: #791
2021-11-01 15:57:13 +09:00