Commit graph

1096 commits

Author SHA1 Message Date
Hermet Park
a459a53bc7 svg2png: revise code to fix memory violation.
previous code didn't take care of multi-threading.

This revise code to avoid changing canvas buffer during multi-tasking.
2021-06-24 10:52:44 +09:00
Hermet Park
59f189bcb4
Update tvgSwMath.cpp
fix typo.
2021-06-23 22:46:41 +09:00
Hermet Park
80090e1189 tvg_loader: recover wrongly introduced change by my mistake. 2021-06-23 19:48:10 +09:00
Hermet Park
c2b84dc500 +++ 2021-06-23 18:59:26 +09:00
Hermet Park
135cba001f tvg_loader: code refactoring.
keep it neat & clean code for better readibility and maintenence.
2021-06-23 18:59:26 +09:00
Hermet Park
bba162b604 sw_engine: fix MSVC compatibility problem.
clz (count leading zero) is builtin function
that is not available in MSVC.

This patch replace clz for MSVC env.

Thanks @fire for pointing out this.

Refers: https://stackoverflow.com/questions/355967/how-to-use-msvc-intrinsics-to-get-the-equivalent-of-this-gcc-code
2021-06-23 16:26:31 +09:00
Hermet Park
4f35c478c2 common: fix compatibility issue for MSVC.
strcasecmp() is not supported by MSVC

We can replace it with _stricmp()

thanks @fire for pointing out this.
2021-06-23 15:50:02 +09:00
Hermet Park
53576d3939 common: fix compatibility issue for MSVC.
__attribute__ syntax is not supported by MSVC.

We can turn it on optionally.
2021-06-23 13:55:10 +09:00
Hermet Park
87b94b7a7f common: fix compatibility issue for MSVC
Math Constants are not defined in Standard C/C++

for this, we can use _USE_MATH_DEFINES before math headers.
2021-06-23 13:38:46 +09:00
Hermet Park
89d35123d8 examples: add commentary for exceptions. 2021-06-23 13:10:02 +09:00
Mira Grudzinska
a0f28d0db4 sw_engine fill: fixing gradient calculations for 'repeat' spread value
There was a call to the ctable element from outside its boundaries, because
the check was misplaced.
2021-06-23 13:01:10 +09:00
Hermet Park
5bbe713ca5 infra: add memory sanitize option in meson
for optimial library, we removed some peripheral information in default,
this breaks asan environment.

This patch changes it to make it both.

if you want to use asan, please change the meson option.

default is disabled.

example)
$meson . build -Db_sanitize=address
$meson . build -Db_sanitize=address,undefined
2021-06-23 11:55:52 +09:00
Mira Grudzinska
5679d666a6 svg_loader: correct parsing ColorStop offset values
Values different from numbers and percentages should be ignored
and the default values should be applied (zeros).
2021-06-23 10:35:58 +09:00
Hermet Park
cadbbb8028 common loadermgr: fix missing break; in switch-case. 2021-06-23 10:18:46 +09:00
JunsuChoi
f20ef0dc15 svg_loader SvgLoader: Copy the missing composite url
When copying an attribute, url information of stype's composite is overwritten with memcpy.
This causes double free by deleting the wrong string in freeNodeStyle.
2021-06-22 10:26:05 +02:00
Hermet Park
234c1cefc8 common scene: fix a regression bug.
That is wrongly changed by 39bf94e506

renderer must be valid until all operations is done.
2021-06-22 17:22:39 +09:00
Hermet Park
58f251163b tvg_loader: code refactoring.
remove if-def code.

Actually, tvg log is supposed to print some useful info for users,
not debugging info for our engine developers.
2021-06-22 17:07:56 +09:00
JunsuChoi
a2d348242b svg_loader SvgLoader: Prevent invalid access
If there is no path information, it is not copied.
2021-06-22 09:55:13 +02:00
Hermet Park
ea668eae1d fix a build break in MSVC
add missing string header, string is used for a Picture::load() parameter
2021-06-22 14:35:46 +09:00
Hermet Park
39bf94e506 common scene: code refactoring.
keep it clean and less LOC.
2021-06-22 13:49:12 +09:00
JunsuChoi
b791924983 svg_loader XmlParser: Fix check the end of string
While skipping the string, check the end of the string first.
Prevents an invalid read when parser really get to the end of the string.
2021-06-22 13:47:26 +09:00
Michal Maciola
24cebf5cc5 common: fix a memory leak after scene->clear(true)
If renderer was null, paints was cleared (count set to zero), but data
was not deleted regardless free boolean.
2021-06-22 11:30:39 +09:00
Hermet Park
0df8c00519 loaders: revise code from cce4b443b3
use copy variable instead of additional buffer pointer.
2021-06-22 10:42:34 +09:00
Michal Maciola
cce4b443b3 loaders: added copy param for Picture::load
@API Changed:
Result Picture::load(const char* data, uint32_t size, bool copy /*=false*/) noexcept
TVG_EXPORT Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, bool copy);
2021-06-21 19:52:38 +09:00
JunsuChoi
f4895459fa test Scene: Separate tests into SECTION()
Split some tests into SECTIONs based on their type.
This improves the readability of TC.

And developer can run test in SECTION unit.
ex)
./build/test/tvgUnitTests "Pushing Paints Into Scene" -c "Pushing Null Pointer"
2021-06-21 19:46:19 +09:00
Mira Grudzinska
8bb10fb261 svg_loader: radial gradient transformation support
For now the gradient radius is scales like x-axis - it has to be changed
after issue #37 will be resolved.
2021-06-21 10:23:42 +09:00
JunsuChoi
b2020a9387 test Scene: Add tvg::Scene unit tests
- Creation
- Push
- Reserve
- Clear
2021-06-18 15:45:36 +09:00
JunsuChoi
d92a2c25f6 infra CI: Upload unit test result to artifact
Users can download the unit test result list from PR-> Checks -> Build Test -> Artifacts.
2021-06-17 21:50:13 +09:00
JunsuChoi
0d28bdfc07 infra CI: Fix test flag of test build
test -> tests
2021-06-17 21:49:54 +09:00
Hermet Park
20c68e3b37 test capi: code refactoring.
keep the coding consistency, no logical changes.

Also, renamed tests to avoid conflicts duplicated names.
2021-06-17 14:57:06 +09:00
Michal Szczecinski
bde0d8e751 utc capi: Added linear gradient tests. 2021-06-17 14:47:35 +09:00
Hermet Park
25b31d9154 test capi: code refactoring.
keep the coding consistency, no logical changes.
2021-06-17 14:38:27 +09:00
Michal Szczecinski
2b78d58c23 utc capi: Added radial gradient tests. 2021-06-17 14:07:11 +09:00
JunsuChoi
6d5d0a154b common Scene: return FailedAllocation if it really failed at memory allocation.
Due to change of f0ecc67, the return type of reserve() is changed to bool,
which can return the result for the fail case.
2021-06-17 13:22:39 +09:00
Mira Grudzinska
2bf21dae3d svg_loader: key and value in the simpleXmlParseW3CAttribute needed to be cleared out of spaces 2021-06-17 11:17:39 +09:00
Mira Grudzinska
7ffeb2e606 svg_loader: fixing color parsing
For colors given in a style attribute in the format "rgb(rrr, ggg, bbb)"
a parsing was incorect. Now fixed.
2021-06-17 11:12:33 +09:00
Mira Grudzinska
20e926c950 svg_loader: after reading an unsupported style attribute no other values were loaded
After finding an unsupported style attribute the log is printed (on request)
and processing of other values continues.
2021-06-17 10:46:20 +09:00
Mira Grudzinska
e0a1aa9355 svg_loader: adding check if stroke-dasharray attribute != none
The stroke-dasharray value equal to "none" was causing a segfault
during a conversion to float. Fixed now.
2021-06-17 10:16:05 +09:00
Michal Maciola
858de0febb utc capi: added capiSwCanvas test cases 2021-06-16 20:48:15 +09:00
Hermet Park
c19aa9fed7 tset capi: code refactoring.
revise coding style.
2021-06-16 12:53:26 +09:00
Hermet Park
fe493a93f2 test capi: fix build infrastructure 2021-06-16 12:22:08 +09:00
mmaciola
3f1b08f050
utc capi: Added capi initializer, canvas, paint and shape utc 2021-06-16 12:16:59 +09:00
Mira Grudzinska
a3e784b6b5 svg_loader: gradient update takes into account a stroke and a fill
For shapes with a grad fill and a grad stroke only the fill was drawn.
After this fix both can have a valid gradient.
2021-06-15 14:25:17 +09:00
Hermet Park
26fd6b5dfd tvg_loader: code refactoring.
renamed internal functions, no logical changes.
2021-06-14 14:32:05 +09:00
Michal Maciola
88a85c68fa loader_mgr: FileTypes order changed
FileType order was changed in tvgLoaderMgr.h to move Tvg at the beginning.

When raw data loading [LoaderMgr::loader(data, size)], loaders are tried
one by one (in order according to the FileType enum) until the correct loader
is found.
When using EFL and load edj, multiple loader(data, size) with tvg data may be
called. This change should improve performance in that case.
2021-06-14 14:18:25 +09:00
mmaciola
fa15b9a2af
tvg_loader: added tvg format verification
TVG format verification was added on TvgLoader:open()
2021-06-14 14:18:10 +09:00
Hermet Park
90dd1b5f98 tests capi: revise the show-case & infrastructure. 2021-06-12 02:11:01 +09:00
Michal Szczecinski
5b99bc186d utc capi: Added shape fill utc. 2021-06-11 23:42:03 +09:00
Michal Maciola
8123250f52 tvg_loader: Fixed missing 'this->' keyword
Fixed missed 'this->' in tvgTvgLoader.cpp
2021-06-11 23:39:10 +09:00
Hermet Park
4795927dc1 fix build break.
regression by - 15b56a66de
2021-06-11 21:04:43 +09:00