Commit graph

971 commits

Author SHA1 Message Date
Mira Grudzinska
0150391f03
tvg_saver: implementation of the Saver class
The Saver class enables to save any Paint object (Scene, Shape, Picture)
in a binary file. To read the file the tvg loader should be used.
To save a paint a new API was introduced - tvg::Saver::save.
2021-07-19 17:31:36 +09:00
Mira Grudzinska
f23cba89f3
common: introducing basic iterators functionality
The introduced Iterator class enables to access the children nodes
of a given Paint.
2021-07-19 17:28:14 +09:00
Hermet Park
9ea6962c5a sw_engine renderer: code refactoring
+ trivial changes while reading the code.
2021-07-19 17:22:27 +09:00
Hermet Park
0ca69c49ff jpg_loader: code refactoring
remove unnecessary member variables.
2021-07-19 16:02:35 +09:00
Mira Grudzinska
96f22e282d
sw_engine: preventing a double application of the opacity (#540)
For filled and stroked shapes with a gradient, the opacity
was applied during the composition and during the ctable update.
To prevent this, in case the composition occured, ctable
is updated with the opacity = 255.
2021-07-19 16:02:10 +09:00
Michal Maciola
8826394b56
jpg_loader: decompress header on opening 2021-07-19 14:55:23 +09:00
Hermet Park
94eeb92dbe infra: seprate test image resources from the examples.
change for removing dependency.
2021-07-19 14:43:26 +09:00
Michal Maciola
b89abde7cb
svg_loader: image tag: force size equal to the viewbox (#603)
* svg_loader: image tag: force size equal to the viewbox

For some svg files it is needed to force size equal the viewbox
for proper scaling

* svg_loader: image tag: force size equal to the viewbox fix #1
2021-07-15 17:48:35 -07:00
Michal Maciola
f9d5c8b42d test: testPicture added .jpg and .png loading tests 2021-07-16 00:36:38 +09:00
Michal Maciola
58ad09a07a
test capi: added missing canvas, paint and shape tests
Added tests for tvg_canvas_reserve, tvg_canvas_update_paint, tvg_paint_duplicate, tvg_paint_set_composite_method, tvg_shape_cubic_to, tvg_shape_close
2021-07-16 00:34:54 +09:00
Michal Maciola
9bfacf2256
test capi: Stroke Radial Gradient
Added tvg_shape_get_gradient
2021-07-16 00:32:41 +09:00
Michal Maciola
c3aef76278 test: render jpg and png files 2021-07-16 00:29:39 +09:00
Michal Maciola
ba1a38ed39 test capi: Stroke Linear Gradient fix #2 2021-07-15 16:06:11 +09:00
Michal Maciola
a757e6b97d test capi: Stroke Linear Gradient fix #1
Added tvg_shape_get_gradient
2021-07-15 16:06:11 +09:00
Michal Maciola
3d672a4ea8 test capi: Stroke Linear Gradient 2021-07-15 16:06:11 +09:00
Michal Maciola
23db42e41c
github actions: added tvg and jpg loaders (#613)
* github actions: added tvg and jpg loaders

* github actions: added tvg and jpg loaders fix #1

Added install libturbojpeg
2021-07-15 09:24:13 +09:00
Michal Maciola
a8e13ed2b7 test: svg rendering
Added SVG file loading and rendering for increasing TC Line coverage
Line coverage for src/loaders/svg: 85.5%
2021-07-14 23:24:40 +09:00
Michal Maciola
9b276cc5fa test capi: scene added negative tests 2021-07-14 23:22:09 +09:00
Michal Maciola
1c30bb391f
example: logo_test.svg (#617)
Manually created svg with edited logo.svg that test most of the svg tags
and attributes
2021-07-14 13:57:32 +02:00
Michal Maciola
dc516df9d8
capi binding: added missing null paint check (#616) 2021-07-14 12:19:42 +02:00
Michal Maciola
30a3d442b9 svg_loader: image tag: fixed utf8 decode
Fixed svgUtilURLDecode function.
Deleted snippet was not needed and it broken decoding when space.
2021-07-14 10:08:15 +09:00
Michal Maciola
8e1d8b0cb2 svg_loader: race condition on arc processing
Unneeded static keyword in _pathAppendArcTo function led to race
conditioning
@issue: #604
2021-07-13 22:23:02 +09:00
JunsuChoi
233045f796 svg_loader SvgPath: Skip invalid path
If the d attribute of SVG path is not parsed through _nextCommand(),
it is regarded as an invalid data.
2021-07-12 16:43:44 +09:00
JunsuChoi
bbc0fbb130 svg_loader SvgUtil: Move nullcheck to before use
prevent invalid access
2021-07-12 13:37:42 +09:00
JunsuChoi
333cac8d9d svg_loader SvgLoader: Initialize to flag value of SvgParser
This patch fixes valgrind detection

$valgrind --leak-check=yes ./Svg

==21410== Conditional jump or move depends on uninitialised value(s)
==21410== at 0x505DB66: _attrParseStops(void*, char const*, char const*) (tvgSvgLoader.cpp:2099)
==21410== by 0x5064F6D: simpleXmlParseAttributes(char const*, unsigned int, bool ()(void, char const*, char const*), void const*) (tvgXmlParser.cpp:319)
==21410== by 0x5061774: _svgLoaderParserXmlOpen(SvgLoaderData*, char const*, unsigned int, bool) (tvgSvgLoader.cpp:2387)
==21410== by 0x5061857: _svgLoaderParser(void*, SimpleXMLType, char const*, unsigned int) (tvgSvgLoader.cpp:2408)
==21410== by 0x5065052: simpleXmlParse(char const*, unsigned int, bool, bool ()(void, SimpleXMLType, char const*, unsigned int), void const*) (tvgXmlParser.cpp:425)
==21410== by 0x5061993: SvgLoader::run(unsigned int) (tvgSvgLoader.cpp:2757)
==21410== by 0x5052F5E: operator() (tvgTaskScheduler.h:68)
==21410== by 0x5052F5E: tvg::TaskSchedulerImpl::run(unsigned int) (tvgTaskScheduler.cpp:138)
==21410== by 0x62C36DE: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==21410== by 0x6DA36DA: start_thread (pthread_create.c:463)
==21410== by 0x68C871E: clone (clone.S:95)
2021-07-12 12:35:42 +09:00
JunsuChoi
f9d82c2c28 svg_loader SvgLoader: Fix memory leak of duplicate declared id
Duplicate declaration of id attribute is invaild.
We do not have a separate policy for invalid svg files.
Therefore, it is a priority to prevent crashes or memory leaks.
If an id is declared as duplicate, the last declared id is used.
2021-07-12 11:21:05 +09:00
Hermet Park
99c37d01cc
Update README.md 2021-07-11 11:37:28 +09:00
Hermet Park
f1db784d87
Update LICENSE 2021-07-11 11:34:59 +09:00
Hermet Park
1238ea242d
Update AUTHORS 2021-07-11 11:33:43 +09:00
Hermet Park
26128807e1 commong shape: --sanitizer report
null pointer passed as argument 2, which is declared to never be null
2021-07-10 23:48:17 +09:00
Hermet Park
c9a083abce
Update CONTRIBUTING.md 2021-07-10 00:34:57 +09:00
Hermet Park
aa1a43e3a2 jpg_loader: code refactoring
keep it clean and neat code add some TODO comments for the future tasks.

This also fixes potential data memory leak.
2021-07-09 21:15:59 +09:00
Michal Maciola
cc71ff43e5 example svg: 'image-embeded.svg' added fix #2
Chenaged indent to tabs
2021-07-09 17:44:00 +09:00
Michal Maciola
9ea99e90e2 example svg: 'image-embeded.svg' added fix #1
Added png image with composition applied
2021-07-09 17:44:00 +09:00
Michal Maciola
f0815934d8 example svg: 'image-embeded.svg' added 2021-07-09 17:44:00 +09:00
Hermet Park
0d71a74de5 jpg_loader: change source file mode 664 2021-07-09 16:53:08 +09:00
JunsuChoi
91cf75ff04 jpg_loader JpgLoader: Prevent memory leak
If the copied data in JpgLoader's data open is invalid,
it is processed without being cleared.
Therefore, data memory free is handled in the destructor.
2021-07-09 16:50:45 +09:00
Michal Maciola
31f45fbd5f svg_loader: <image> tag introduced fix #9
Fixed Base64 and utf8 for new line and whitespace
Changed tvgSvgLoaderCommon.h to single line convention
2021-07-09 12:04:29 +09:00
Michal Maciola
28342c5c1f svg_loader: <image> tag introduced fix #8
Disable embedded svg files to protect against recursive svg image loading
2021-07-09 12:04:29 +09:00
Michal Maciola
48bc30e70a svg_loader: <image> tag introduced fix #7
fixed auto and new lines in tvgSvgUtil.cpp
2021-07-09 12:04:29 +09:00
Michal Maciola
1f67c1d689 svg_loader: <image> tag introduced fix #6
Moved file:// removing into _imageBuildHelper
2021-07-09 12:04:29 +09:00
Michal Maciola
3e4512a9a6 svg_loader: <image> tag introduced fix #5
Added copyAttr for image
2021-07-09 12:04:29 +09:00
Michal Maciola
e01f29270a svg_loader: <image> tag introduced fix #4
fixed mistyped vw to w and vh to h
2021-07-09 12:04:29 +09:00
Michal Maciola
d69805c668 svg_loader: <image> tag introduced fix #3
Added working composition
2021-07-09 12:04:29 +09:00
Michal Maciola
c35f7e1f64 svg_loader: <image> tag introduced fix #2
Removed #ifdef from tvgSvgSceneBuilder.cpp
2021-07-09 12:04:29 +09:00
Michal Maciola
9c1af3dde5 svg_loader: <image> tag introduced fix #1
Fixed href string deleting
2021-07-09 12:04:29 +09:00
Michal Maciola
80fa97d366 svg_loader: <image> tag introduced
This patch introduces embeded <image> tag for svg files.
Images can be now loaded from local path or using data URI Scheme (RFC2397).
Base64 and utf8/uri are welcome.

@issue: #518
2021-07-09 12:04:29 +09:00
Hermet Park
af140a1fe5 svg_loader: fix gradient memory leak.
@Issue: https://github.com/Samsung/thorvg/issues/548
2021-07-09 11:58:44 +09:00
Hermet Park
3997aedcd5 svg_loader: optimize memory usage.
-- unnecessary memory fragmentation.
2021-07-09 11:58:44 +09:00
Michal Maciola
957ad5d017 example: PictureJpg.cpp
Created an example for testing jpg loading
2021-07-08 23:17:05 +09:00