Commit graph

418 commits

Author SHA1 Message Date
Hermet Park
8d31496648 infra: print enabled features in the meson summary list.
instead removed individual messages.
2021-07-03 14:58:17 +09:00
Hermet Park
8aa941c4ab common picture: ++exception case.
Fixed load() to return InvalidArgument if the file path is invalid.
2021-07-02 14:01:52 +09:00
Hermet Park
3f176b733b common picture: ++ exception case.
size() returns InsufficientCondition if it doesn't have any loaded data.
2021-07-02 12:07:34 +09:00
Hermet Park
2fd830c940 common shape: allow to reset stroke dash.
user may need to reset stroke dash to off,
now stroke api allows it.
2021-07-02 10:35:46 +09:00
Hermet Park
e74ce7e315 sw_engine: --sanitizer errors
runtime error: load of value 190, which is not a valid value for type 'bool'

@Issue: https://github.com/Samsung/thorvg/issues/544
2021-07-01 17:59:27 +09:00
Hermet Park
480bd8376e common array: -- sanitizer errors
runtime error: null pointer passed as argument 1, which is declared to never be null

@Issue: https://github.com/Samsung/thorvg/issues/543
2021-07-01 17:41:56 +09:00
Hermet Park
e1eabf7dc3 Revert "sw_engine: stop-opacity value should be interpolated between stops"
This reverts commit ac95433b53.

Ahh this breaks examples/images/rg1024_eggs.svg
2021-07-01 17:34:59 +09:00
Hermet Park
1154986a58 sw_engine: fix broken MSVC compatibility.
error: use of undeclared identifier 'ulong'

@Issue: https://github.com/Samsung/thorvg/issues/541
2021-07-01 12:06:18 +09:00
Mira Grudzinska
ac95433b53 sw_engine: stop-opacity value should be interpolated between stops
The opacity value is interpolated as are all color channels.
2021-06-30 19:32:52 +09:00
Hermet Park
38fa5107bf sw_engine rle: -- sanitizer reports.
The code is actually intended, we can modify it to ignore the
annoying sanitizer reports.

@Issue: https://github.com/Samsung/thorvg/issues/483
2021-06-29 15:56:11 +09:00
Hermet Park
c31156e737 sw_engine renderer: fix a broken composition bug
tvg sw_engine tries to skip composition as far as its doable,
it tries composition only if the translucent shape with stroking is there.

There has been a condition bug that composition is applied unnecessarily
even if stroking is disabled. This resulted in broken blending
at gradient filling since it applied alpha values multiple times.

Issues:
https://github.com/Samsung/thorvg/issues/445
2021-06-29 14:44:09 +09:00
Mira Grudzinska
6eea979dae common: introducing the composite API (getter)
The new API gets the composite method and the pointer to the composite
target of the given paint object.
2021-06-25 22:16:06 +09:00
Mira Grudzinska
96d6b47a64 common: PaintType enum changed to identifier in Paint class
The PaintType enum was used to set the paint type in the internal Paint
implementation. This solution is switched to an identifier with id() getter,
so that the information about the type can be reached from outside the Paint.
2021-06-25 22:13:20 +09:00
Mira Grudzinska
286f700305 svg_loader: handling the ColorStop offset values
The ColorStop offset < 0 and > 1 should be treated as 0 and 1 respectively.
The offset value < than the previous offset value should be replaced
by the previous value - without this change segfault occurred.
Validating the APIs parameters values is the user responsibility.
2021-06-24 20:54:03 +09:00
Hermet Park
750ad90bf0 sw_engine stroke: set stroke invalid if points are zero.
This valid tag is used for further progress.
we don't need it actually since we can count by points number.
2021-06-24 20:50:37 +09:00
Hermet Park
59f189bcb4
Update tvgSwMath.cpp
fix typo.
2021-06-23 22:46:41 +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
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
cadbbb8028 common loadermgr: fix missing break; in switch-case. 2021-06-23 10:18:46 +09: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
39bf94e506 common scene: code refactoring.
keep it clean and less LOC.
2021-06-22 13:49:12 +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
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
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
Hermet Park
4795927dc1 fix build break.
regression by - 15b56a66de
2021-06-11 21:04:43 +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
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
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
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
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
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
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
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
1c53d47f81 sw_engine mempool: tiny optimization.
don't mempool anything if the option is same.
2021-06-07 19:40:56 +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
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
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
a864a5a0ac sw_engine rle: code refactoring.
keep it neat code, --loc
2021-06-03 11:45:59 +09:00
Hermet Park
a8a120942e sw_engine: data optimization.
changed alpha channel data type to 32 bits from 8 bits,
since subsequent data operations requires 32 bits values.

this 8 bits (since channel range is up to 255) doesn't helpful
for saving memory size because it would generate additional data casting by compiler.

I compared the binary size and this patch saves about 600bytes.
2021-06-02 21:15:58 +09:00