Commit graph

827 commits

Author SHA1 Message Date
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
Michal Maciola
9453273fc8 capi: picture load data
Added 'tvg_picture_load_data' capi.
2021-06-11 20:54:07 +09:00
Hermet Park
15b56a66de tvg_loader: code refactoring.
revise it under the tvg coding convention.
2021-06-11 20:51:50 +09:00
Hermet Park
52d95dcb59
tests: add SwCanvasBase unit tests 2021-06-11 15:14:35 +09:00
Hermet Park
58fefeb05f examples tvg: clean up for tvg consistency.
no logical changes.
2021-06-11 12:58:15 +09:00
mmaciola
2c1f165f19
TVG Loader/Saver module: tvg loader example 2021-06-11 12:51:35 +09:00
mmaciola
16e39ee81b
TVG Loader/Saver: tvg loader introduced
This patch introduces tvg loader module for loading .tvg binary files.
This allows to load and reuse pregenerated scene.

tvg file format:
.tvg is a binary file format designed for saving/restoring the scene content.
It allows to save scenes and reuse them in other apps or to restore state of
the application.

@Example:
   auto picture = tvg::Picture::gen();
   picture->load(EXAMPLE_DIR"/tvg_file.tvg");
   canvas->push(move(picture));

@API Additions:
   Result paint(std::unique_ptr<Paint> paint) noexcept;

@Issue: Issue ticket is #375.
2021-06-11 12:49:37 +09:00
Hermet Park
b7431eab3e examples: updated samples.
one of children paint can not be updated immediately with a canvas.

the root paint must be passed, otherwise requesting whole canvas is the best idea.
2021-06-10 20:00:55 +09:00
Hermet Park
ea8d26a681 examples: revise examples
remove the show-cases that accessing the raw memory from the unique_ptr

we don't like to use those cases without any inevitable excuse.
2021-06-10 16:08:00 +09:00
Hermet Park
6b75ce3476 common canvas: ++ case cover exception scenarios.
Do not update the paint if it's not pushed in the canvas.
2021-06-10 15:50:56 +09:00
Hermet Park
2401495c47 examples: updated svg samples 2021-06-10 11:59:45 +09:00
Mira Grudzinska
9b1356e7cb svg_loader: support stroke gradient
The loader was ready to handle the gradient stroke, but there was no API to support
it when the loader was introduced. We've had this API for a while already, so
its call has been added.
2021-06-10 11:36:20 +09:00
Hermet Park
4acf89cf96 common canvas: ++ exception handling.
canvas update won't be performed if it's on drawing condition nor zero paints.
2021-06-10 11:34:24 +09:00
Hermet Park
85587bbe79 examples stacking: ++ scene stacking. 2021-06-09 21:07:13 +09:00
Hermet Park
13009657cd common canvas: supplement corner cases.
filled up corner cases to return the result properly.

Canvas newly has a drawing condition to prevent usage-violation.
2021-06-09 20:11:57 +09:00
Hermet Park
2d2c88b153 test SwCanvas: ++ case cover.
All prerequiste condition must be passed successfully.
Each test case should verify them before actual unit-test.
2021-06-09 18:11:51 +09:00
Hermet Park
9b204fb983 test SwCanvas: -- out of spec, don't guratee the result. 2021-06-08 17:30:00 +09:00
Hermet Park
83d860b150 test SwCanvas: ++case cover 2021-06-08 17:26:36 +09:00
Mira Grudzinska
f3fac71a12 sw_engine: added check whether surface width <= surface stride
In a case width > stride segf occured. Such a case should be treated
as an invalid arg.
2021-06-08 17:20:46 +09:00
Hermet Park
5c26014e2f tests: add SwCanvas unit tests 2021-06-08 17:20:23 +09:00