JunsuChoi
b17f3cc9a4
svg2png: Clean up code
...
Modify the code to fit coding style
2021-06-24 11:31:15 +09:00
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
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
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
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
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
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