Hermet Park
8059a23f7c
tvg format: code refactoring #2
...
code clean up, removed reserved data sector
2021-07-20 12:53:16 +09:00
Hermet Park
0ca69c49ff
jpg_loader: code refactoring
...
remove unnecessary member variables.
2021-07-19 16:02:35 +09:00
Michal Maciola
8826394b56
jpg_loader: decompress header on opening
2021-07-19 14:55:23 +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
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
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
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
bb19bcf64f
svg_loader: postpone cloneNode()
...
Some svg export software puts <defs> element at the end of the file.
If so, the <defs> element won't be found, when parsing <use>.
In such scenario, this patch postpone node cloning until the whole file
is parsed.
@issue: #568
2021-07-07 15:34:15 +09:00
Michal Maciola
eddbb4d71d
jpg_loader: introduced jpg decode using libjpeg-turbo fix #1
...
Added bool open(const char* data, uint32_t size, bool copy);
2021-07-07 13:44:16 +09:00
Michal Maciola
0435f29f11
jpg_loader: introduced jpg decode using libjpeg-turbo
...
This patch introduces a jpg loader.
For decoding the image, libjpeg-turbo library is used. Library was found to be
fast (SIMD instructions accelerated) and portable.
@issue: #517
2021-07-07 13:44:16 +09:00
JunsuChoi
ea3d79f5f3
svg_loader: Support percentage unit of dash-array
...
Refers to the diagonal length of the viewport.
https://www.w3.org/TR/SVG2/coords.html#Units
2021-07-07 09:48:46 +09:00
Michal Maciola
1e1f232016
png_loader: added open from memory
...
Added PngLoader::open(const char* data, uint32_t size, bool copy)
Changed variables visibility to private
2021-07-06 18:32:08 +09:00
Mira Grudzinska
1507438ecc
svg_loader: set the priority for the style attribute for stop properties
...
Stop properies stop-color and stop-opacity set using a style attribute should
have higher priority than properties set in a different way.
2021-07-06 10:13:58 +02:00
Mira Grudzinska
fff5bfee83
svg_loader: set the higher priority of style attributes
...
issue #515
2021-07-06 10:13:58 +02:00
Michal Maciola
7a8d7ceac6
svg_loader: fix dead loop on none digit char in stroke-dasharray fix #3
...
Added zero and negative value protection
2021-07-06 10:39:34 +09:00
Michal Maciola
bf8c633d38
svg_loader: fix dead loop on none digit char in stroke-dasharray fix #2
...
Moved _skipComma at the begining of the loop
2021-07-06 10:39:34 +09:00
Michal Maciola
2f8c00580d
svg_loader: fix dead loop on none digit char in stroke-dasharray
2021-07-06 10:39:34 +09:00
Hermet Park
8e2765be39
common picture: fix invalid size returns from raw image.
...
picture/raw should update the size if the raw image
with size values are entered.
2021-07-03 16:15:57 +09:00
Hermet Park
8d31496648
infra: print enabled features in the meson summary list.
...
instead removed individual messages.
2021-07-03 14:58:17 +09:00
Michal Maciola
99263d54d1
svg_loader: multiple composition memory leak
...
Multiple composition are still not supported, but this patch fixes a
memory leak if it is tried to be applied.
2021-07-03 14:14:01 +09:00
Michal Maciola
6a09a8f015
svg_loader: memory leak after improper stop tag fix #1
...
Updated printf message
2021-07-03 13:50:03 +09:00
Michal Maciola
b005f97bcd
svg_loader: memory leak after improper stop tag
...
<stop> tag should be always a child of a <linearGradient> or
<radialGradient> element, but there were files with <stop> tag inside <rect>.
This patch fixes a memory leak if no gradient is defined before <stop> tag.
2021-07-03 13:50:03 +09:00
JunsuChoi
113ca8b845
svg_loader SvgPath: Added corner case handling for flags of Arc
...
Moved the if statement to check if it is a float.
This patch is that reverts and fixes the reverted patch 55a5b9.
2021-07-02 12:49:00 +09:00
Hermet Park
55a5b9492b
Revert "svg_loader SvgPath: Added corner case handling for flags of Arc"
...
This reverts commit 5da4c81138
.
Please double-check this regression bug:
examples/images/samsung-galaxy-s.svg
2021-07-01 18:04:25 +09:00
Mira Grudzinska
f411b5a64c
svg_loader: recalculating the default values of grads
...
The default values of gradient properties were handled differently
than the values given by a user/in an svg file.
2021-07-01 12:15:55 +09:00
Michal Maciola
3086f28b55
svg_loader: allow multiple <defs> tags without data and memory leak ( #528 )
...
* svg_loader: allow multiple defs without data and memory leak
If the svg file contained multiple <defs> tags, each subsequent tag
overwritten the previous tag. This resulted in incorrect rendering of the
file and memory leaks.
@Issues: 491
* svg_loader: allow multiple defs without data and memory leak- fix #1
Changed the idea to abandon node creating instead of deleting it after
creation. Removed simpleXmlParseAttributes for _createDefsNode.
2021-06-30 17:21:30 +09:00
Hermet Park
19a3190245
svg_loader: fix a infinite loop error by circular dependency.
...
Composition can be applied recursively if its children nodes have composition target to this one.
This can be occured by wrong svg description, and tvg prevents this exception case.
@Issue: https://github.com/Samsung/thorvg/issues/494
2021-06-30 16:12:16 +09:00
Hermet Park
fcbc77bcdf
svg_loader: code refactoring
...
unify to tvg fill rule.
2021-06-30 15:18:14 +09:00
Hermet Park
2c24a1fa5e
svg_loader: recover partial code from 3e7888b538
...
oops, log was not tested in the patch...
2021-06-30 15:12:15 +09:00
Hermet Park
571a1e5caa
svg_loader: code refactoring
...
remove more unused declarations...
2021-06-30 14:54:22 +09:00
Hermet Park
3e7888b538
svg_loader: code refactoring
...
use color structure to keep neat & compact code.
2021-06-30 14:54:12 +09:00
Hermet Park
8dc5d5204b
svg_loader: code refactoring
...
remove unused declaration.
2021-06-30 13:47:22 +09:00