Commit graph

1172 commits

Author SHA1 Message Date
Hermet Park
3ee6883f16 tvg_saver: fix the memory leak. 2021-09-24 11:58:48 +09:00
Hermet Park
c8cc973888 tvg_loader: resolve sanitizer report.
"runtime error: load of misaligned address 0x7fb67895c815 for type 'unsigned int', which requires 4 byte alignment"

This is actually not an issue but we can resolve it with an easy workaround,
since we don't need to see this report repeatedly.
2021-09-24 11:53:46 +09:00
Hermet Park
9128272ee3 infra: turn off the simd option in default.
avx is unstable, we can't recommend to use it.
2021-09-24 11:34:42 +09:00
Hermet Park
74954db56d common paint: refine the bounds() api to return the values after applying transformation.
Current paint::bounds() returns the coordinates under the raw status,
the values are not quite useful if the paint object has the transformed children.

Thus, we extends the feature and give an additional parameter "transformed"
to return the coordinates values after transformation by user demands.

This is also necessary for tvg format, since we need the exact view size of the scene information.

The previous api is deprecated and we introduce a new api to replace it.

@APIs:
+ Result Paint::bounds(float* x, float* y, float* w, float* h, bool transformed) const noexcept;
- Result Paint::bounds(float* x, float* y, float* w, float* h) const noexcept;

@Issues: https://github.com/Samsung/thorvg/issues/746
2021-09-24 11:25:49 +09:00
Hermet Park
000d3ec2f0 apis: release official apis.
tvg picture is going to be released, we need the Saver as well.
Also, two stable periperal apis are released in v0.5

@APIs:
Result Picture::load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false) noexcept;
CompositeMethod Paint::composite(const Paint** target) const noexcept;
Result Saver::save(std::unique_ptr<Paint> paint, const std::string& path, bool compress = true) noexcept;
Result Saver::sync() noexcept;
static std::unique_ptr<Saver> Saver::gen() noexcept;
2021-09-24 11:25:27 +09:00
Hermet Park
e784143ff8 api: remove the redundant api, Picture::paint().
tvg::Picture is replaced to tvg::Scene if the picture has the vector tree,
Thus it's useless since it won't be reached logically.
2021-09-23 20:15:23 +09:00
JunsuChoi
56d31775ff
sw_engine Raster: Improving image quality in image scale down
An average value sampled based on adjacent pixels of the target pixel is used.
2021-09-23 14:39:58 +09:00
Michal Maciola
dcbcc409df
wasm: enable png loader (#828) 2021-09-22 15:11:23 +02:00
Michal Maciola
4c13246f9c
example image: added image image-embeded-png.svg (#827) 2021-09-22 15:08:14 +02:00
Mira Grudzinska
8ef928fcfc sw_engine avx: removing not portable variable type
__m256i_u is an internal gcc/clang type, which can not be used by msvc.
To ensure the portability of the lib a proper intrinsic is used.
2021-09-22 12:41:57 +09:00
Mira Grudzinska
90fa4fbe6d common: change args type in the internal size() implementation
The API expected floats, whereas the called impl function expected
ints. The values were saved as floats, so the float->int->float conversion
is not needed.
2021-09-22 12:40:13 +09:00
Mira Grudzinska
c5430684d1 infra: excluding pthread lib dependency on windows os 2021-09-22 12:38:17 +09:00
Mira Grudzinska
cfacdd705f example: refactoring 2021-09-22 01:13:52 +02:00
Michal Maciola
702f452c6c svg: fix url property
If 'fill="url(#image)"' and defs with id 'image' was not found, the paint was
improperly filled with color.
2021-09-21 20:20:59 +02:00
Mira Grudzinska
4589196689
common: preventing msvc compiler warnings (#817) 2021-09-20 13:54:06 +02:00
Mira Grudzinska
9d63e2894d common: preventing possible compiler warnings 2021-09-19 19:53:40 +02:00
Hermet Park
75e1310c7a prepare to release tvg format feature. 2021-09-16 17:46:10 +09:00
Hermet Park
3d93867e8e tvg_saver: code refactoring
removed the duplicated given child transform code,

no logical changes actually.
2021-09-16 15:01:42 +09:00
Hermet Park
80a940c70a examples: updated tvg resources. 2021-09-16 12:47:05 +09:00
Mira Grudzinska
6b216e362d tvg_saver: proper serialization of a grad fill
In the case when a gradinet fill is present, the transformation matrix
can't be preapplied.
2021-09-16 12:40:37 +09:00
Michal Szczecinski
09301dfde1 sw_engine: Fixed build errors. 2021-09-16 12:27:04 +09:00
Hermet Park
ee7dc1352e tvg_saver: do not merge if the shapes have outlines.
Merged shapes with outlines expects the layered,
unfortunately tvg can't cover the situation.

@Issues: https://github.com/Samsung/thorvg/issues/783
2021-09-16 00:06:01 +09:00
Hermet Park
e5f8bc99b7 examples: updated favorite tvg to fix position issue. 2021-09-15 20:06:20 +09:00
Hermet Park
c4e1a1f752 examples: updated tvg resources
these two resources were fixed by the positioning.
2021-09-15 19:41:11 +09:00
Hermet Park
4142237cac examples: updated tvg resources 2021-09-15 19:16:44 +09:00
Mira Grudzinska
c9c3776207 svg_loader: proper svg resizing
Solves the problem of 'vx' and 'vy' < 0 and cases with 'width'
and 'height' values different than widht and height from the 'viewBox'
attribute.
2021-09-15 19:12:43 +09:00
Michal Maciola
1d8625d40d
wasm: paint opacity in the layers list (#804) 2021-09-14 14:27:39 +02:00
Hermet Park
47c1aac562 examples: updated tvg sample 2021-09-14 19:53:12 +09:00
Hermet Park
e3266ac19c examples: extends svg samples 2021-09-13 20:49:46 +09:00
Mira Grudzinska
d3368c9727 svg_saver: shifting 'preTransform' value changing
'preTransform = false' makes sense in case a stroke exist,
so not only when the stroke-width > 0 but when it's color
is valid as well.
2021-09-11 10:49:09 +09:00
Michal Maciola
150cff0fd5
example images: added rotlines.svg (#796) 2021-09-10 13:31:20 +02:00
Michal Maciola
e62f8a0db4
wasm: improved bounds calculation (#795)
Improved bounds calculation in case a rotation is applied
2021-09-10 13:26:58 +02:00
Hermet Park
8c2e762e98
Update README.md 2021-09-09 22:30:03 +09:00
Michal Maciola
e91dcdb0de
wasm: validate empty data (#790) 2021-09-09 10:45:58 +02:00
Michal Maciola
b294a71613
wasm: remove default data (#789) 2021-09-09 10:40:19 +02:00
Hermet Park
4e9452c4b8 api: removed unused 2021-09-09 14:18:46 +09:00
Michal Maciola
2a2ccb30bd
Wasm: allow iterator and add functions for layers revising (#730)
* common: move iterator functionality into separate IteratorModule
* wasm: allow internal lib dependencies and iterator
* wasm: added functions for layers revising

This patch adds functions to thorvgwasm.cpp:
 layers() - that return a list of paints in a picture
 bounds() - that returns a bounds of a given paint
 setOpacity() - that sets the opacity of a given paint
2021-09-09 13:06:13 +09:00
Michal Maciola
f732479acc wasm: pass mimetype on loading and store original size
This patch adds the mimetype parameter for load() function and adds storing of
an original size after successful loading. Added function originalSize().
2021-09-09 12:55:56 +09:00
Hermet Park
79933d9efa api: set default value nullptr for user convenience. 2021-09-09 12:40:43 +09:00
Michal Maciola
8c4197a8a5 wasm: add force parameter for update() function 2021-09-09 11:48:53 +09:00
Hermet Park
1ea9692841 sw_engine image: fix the clipped image issue.
there was a wrong condition introduced the bug that image was not updated,
because transformation is not re-applied after the first created the internal image data.

@Issues: https://github.com/Samsung/thorvg/issues/751
2021-09-09 11:31:05 +09:00
Hermet Park
789083527e examples: updated a tvg resource. 2021-09-09 11:05:54 +09:00
Mira Grudzinska
288c9f5c1d tvg_saver: fix the stroke width scaling factor
To get the scaling factor from the transformation matrix we have
to use two of its elements.
2021-09-08 10:36:59 +02:00
Hermet Park
b495f04ef4 examples tvg: added a new example to verify tvg resources.
These tvg resources might be updated before official release.
2021-09-08 13:29:04 +09:00
Mira Grudzinska
ae6d574466 sw_engine: overlaping stroke cap
A square or a round cap was mistakenly added to the parts
of the dashed lines that should be continuous. Fixed

@Issues: https://github.com/Samsung/thorvg/issues/777
2021-09-08 11:17:42 +09:00
Hermet Park
f652b33a27 tvg_saver: fix a wrong logic by mistake.
an incorrect logic was introduced by mistake.

that breaks the tvg memory chunks.

now recover it.

@Issues: https://github.com/Samsung/thorvg/issues/774
2021-09-07 12:22:23 +02:00
Hermet Park
e381edacb7 tvg_loader: code refactoring.
no logical changes in the succesful cases,

change the code for better readibility.
and add log messages in the error scenario.
2021-09-07 18:18:09 +09:00
Hermet Park
f1d9f691cc tvg_saver: fix the incorrect stroke transformation
Saver tries to pre-transfom to skip the matrix data,
but it missed the case - transformed stroking,

we skip it also only when xy scaling factors are same excluding the dash properties,
because scaled of the stroking is depent on the engines,
we have no idea of the proper input data in advance.

@Issues: https://github.com/Samsung/thorvg/issues/773
2021-09-07 10:56:43 +02:00
Mira Grudzinska
b421660676 svg_loader: parsing flags in the elliptical arc curve
Since the arc flags can have values 0 or 1, we reported as
an error cases, when a float value was given.
Since the EBNF grammar can be used, we misread some paths.
Removing the condition that prevents giving a float as a flag solves
this problem and is in agreement with the w3 specs.
2021-09-07 13:15:50 +09:00
Hermet Park
d21089ddfd
tvg_saver: save the missing scene reserve count. (#771)
This reserved count was just missed,
Aside from it, tvg_loader logic is not well organized (hard to expect)
We can refine it by recovering the data tree structure in the reverse order.

@Issues: https://github.com/Samsung/thorvg/issues/768
2021-09-06 08:38:18 +02:00