Commit graph

802 commits

Author SHA1 Message Date
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
Mira Grudzinska
419751c736 sw_engine: fixing the composition for canvas width != canvas stride
When canvas width was smaller than its stride and a composition is used,
the plots were drawn incorrectly. This is fixed by setting the image width
(image from a compositor) to be equal to the surface stride, instead of its width.
The image data are now allocated accordingly the fixed image width.
2021-06-08 17:19:59 +09:00
Hermet Park
f0598a7481 Revert "tests: add SwCanvas base part unit tests"
This reverts commit ce6348a504.

This isn't intended pushing...
2021-06-07 20:09:02 +09:00
Hermet Park
f0ecc670ef common canvas: return FailedAllocation if it really failed at memory allocation.
This fixes SwCanvasBase Reservation Unit Test.
2021-06-07 20:04:39 +09:00
Hermet Park
ce6348a504 tests: add SwCanvas base part unit tests 2021-06-07 19:57:52 +09:00
Hermet Park
1c53d47f81 sw_engine mempool: tiny optimization.
don't mempool anything if the option is same.
2021-06-07 19:40:56 +09:00
JunsuChoi
3c19f2aaf5 svg_loader SceneBuilder: Remove incorrect calculation for radial gradient
We are doing enough calculations in the parser if the unit is user space.
This causes the cx,cy coordinates of radial gradient to be calculated incorrectly.
So remove it.
2021-06-07 19:12:17 +09:00
JunsuChoi
bd566bdcb2 svg_loader SceneBuilder: Remove incorrect calculation for linear gradient
Calculation of objectBoundingBox case in linear gradient is incorrect code.
This causes the x,y coordinates of the linear gradient to be calculated incorrectly.
So remove it.
2021-06-07 19:12:17 +09:00
Hermet Park
50b2b1c7de sw_engine renderer: fix to success SwCanvas Unit Test.
render init count shouldn't be counted when it's in a fail-case.
2021-06-07 18:09:35 +09:00
Hermet Park
eda022365f canvas: fix for SwCanvas Unit Test
Fixed to fail canvas generation if engines are not initialized.
2021-06-07 18:01:26 +09:00
Hermet Park
314b96651b doc: correct the beginning year 2021-06-07 17:39:45 +09:00
Hermet Park
7a407eb8bb common: fix typo 2021-06-07 17:36:19 +09:00
Michal Maciola
c7ccca79b3 TVG Loader/Saver: tvg helper file ('tvgTvgHelper.h') introduced
This patch introduces tvgTvgHelper.h file that contains base definitions used
for .tvg loader and saver modules. Indicators, flags and sizes are defined
and base tvgBlock struct is declared here.
'tvgTvgHelper.h' file is essential only for .tvg loader/saver module and it
doesn't affect any other file. Loader and saver modules itself are introduced
in other, further patches.

.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.
2021-06-07 13:02:44 +09:00
Hermet Park
9873539b04 common taskScheduler: fix wrong thread indexing due to duplicated variable names.
That mistake could invoke inproper threads....
2021-06-07 12:57:35 +09:00
Mira Grudzinska
ae5673658e svg_loader: initializing uninitialized variables
The 'loader->svgParse->global' variable was uninitialized when no viewBox attribute
was set. If gradient was applied, the division by zero occured and no gradient was drawn.
2021-06-07 12:30:56 +09:00
Hermet Park
73ea4abf51 infra: just released v0.2.0 2021-06-06 17:36:48 +09:00
Hermet Park
59198d2735 infra: set higher version to try the devel symbols with higher priority than released ones. 2021-06-06 17:12:41 +09:00
Michal Szczecinski
f8b636d4d0 common gradient: Fix possible crash in color setter
Memcpy is not allowed on nullptr. If colorStops is invalid colors are
cleared.
2021-06-04 21:36:16 +09:00
Michal Maciola
718578532c capi: include <stdint.h> into thorvg_capi.h 2021-06-04 19:52:34 +09:00
Hermet Park
1fedb49e59
Update CONTRIBUTING.md
fix typos.
2021-06-04 17:46:04 +09:00
Hermet Park
5abcb19e6c
Update CONTRIBUTING.md
++ self-test & verification
2021-06-04 17:43:04 +09:00
Hermet Park
b299157123 capi: add tvg_paint_get_transform() api. 2021-06-04 16:48:00 +09:00
Hermet Park
6b7aa8ad9e
tests: introduce catch2 unit tests infrastructure.
Catch2 is a multi-paradigm test framework for C++.
It is primarily distributed as a single header file,
very easy and simple to adopt this to thorvg project.

This patch introduces catch2 infrastsructure and one prototype as a sample.

You can refer "testInitializer.cpp", how to add unit test!
while ignoring else files such as "catch2.hpp", "testMain.cpp"

Also, enable Unit-tests with meson option when you change any thorvg code.

$meson build -Dtests=true.

launch tvgUnitTest in the build result then verify 100% coverage
before submitting any patches.
2021-06-04 16:46:34 +09:00
Hermet Park
efa0035fe6 common initializer: correct the result value.
When memory is not allocated successully, it must return the FailedAllocation as the return value.
Previous initializer wrongly returns the value that case, this corrects it.
2021-06-03 20:48:02 +09:00
Hermet Park
c2b2aa92c3 infra: install capi header file only its binding option is enabled.
decouple the capi header from the default headers by replacing it in capi folder.
now it's also installed optionally.
2021-06-03 20:43:39 +09:00
Hermet Park
bbfbe95ecc test: remove gtest & its infra.
thorvg is going to use catch2 framework, this is a cleanup work
before introducing catch2 utc.

See Catch2:
https://github.com/catchorg/Catch2/tree/v2.x
2021-06-03 17:38:07 +09:00