platform/core/graphics/tizenvg.git
3 years agotest capi: scene added negative tests
Michal Maciola [Wed, 14 Jul 2021 09:59:50 +0000 (11:59 +0200)]
test capi: scene added negative tests

3 years agoexample: logo_test.svg (#617)
Michal Maciola [Wed, 14 Jul 2021 11:57:32 +0000 (13:57 +0200)]
example: logo_test.svg (#617)

Manually created svg with edited logo.svg that test most of the svg tags
and attributes

3 years agocapi binding: added missing null paint check (#616)
Michal Maciola [Wed, 14 Jul 2021 10:19:42 +0000 (12:19 +0200)]
capi binding: added missing null paint check (#616)

3 years agosvg_loader: image tag: fixed utf8 decode
Michal Maciola [Tue, 13 Jul 2021 09:26:15 +0000 (11:26 +0200)]
svg_loader: image tag: fixed utf8 decode

Fixed svgUtilURLDecode function.
Deleted snippet was not needed and it broken decoding when space.

Change-Id: I1f14ff60c10f8c73006c7ab4fc6bf0b0f945d02e

3 years agosvg_loader: race condition on arc processing
Michal Maciola [Tue, 13 Jul 2021 12:28:52 +0000 (14:28 +0200)]
svg_loader: race condition on arc processing

Unneeded static keyword in _pathAppendArcTo function led to race
conditioning
@issue: #604

Change-Id: I1741b56f6cf210b7709f513aceb657840851b3bf

3 years agosvg_loader SvgPath: Skip invalid path
JunsuChoi [Mon, 12 Jul 2021 02:55:33 +0000 (11:55 +0900)]
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.

3 years agoMerge "bump up version v0.3.0" into tizen accepted/tizen/unified/20210713.124127 submit/tizen/20210712.055754
Hermet Park [Mon, 12 Jul 2021 04:47:10 +0000 (04:47 +0000)]
Merge "bump up version v0.3.0" into tizen

3 years agosvg_loader SvgUtil: Move nullcheck to before use
JunsuChoi [Mon, 12 Jul 2021 04:26:32 +0000 (13:26 +0900)]
svg_loader SvgUtil: Move nullcheck to before use

prevent invalid access

3 years agosvg_loader SvgLoader: Initialize to flag value of SvgParser
JunsuChoi [Mon, 12 Jul 2021 00:57:48 +0000 (09:57 +0900)]
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)

3 years agosvg_loader SvgLoader: Fix memory leak of duplicate declared id
JunsuChoi [Mon, 12 Jul 2021 01:14:51 +0000 (10:14 +0900)]
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.

3 years agobump up version v0.3.0 98/261098/1
Hermet Park [Mon, 12 Jul 2021 03:34:10 +0000 (12:34 +0900)]
bump up version v0.3.0

Change-Id: I14dee32b383a9af4e4a334df4b88a9767d210ad6

3 years agoUpdate README.md
Hermet Park [Sun, 11 Jul 2021 02:37:28 +0000 (11:37 +0900)]
Update README.md

3 years agoUpdate LICENSE
Hermet Park [Sun, 11 Jul 2021 02:34:59 +0000 (11:34 +0900)]
Update LICENSE

3 years agoUpdate AUTHORS
Hermet Park [Sun, 11 Jul 2021 02:33:43 +0000 (11:33 +0900)]
Update AUTHORS

3 years agocommong shape: --sanitizer report
Hermet Park [Sat, 10 Jul 2021 14:48:17 +0000 (23:48 +0900)]
commong shape: --sanitizer report

null pointer passed as argument 2, which is declared to never be null

3 years agoUpdate CONTRIBUTING.md
Hermet Park [Fri, 9 Jul 2021 15:34:57 +0000 (00:34 +0900)]
Update CONTRIBUTING.md

3 years agojpg_loader: code refactoring
Hermet Park [Fri, 9 Jul 2021 08:37:58 +0000 (17:37 +0900)]
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.

3 years agoexample svg: 'image-embeded.svg' added fix #2
Michal Maciola [Thu, 1 Jul 2021 08:53:06 +0000 (10:53 +0200)]
example svg: 'image-embeded.svg' added fix #2

Chenaged indent to tabs

3 years agoexample svg: 'image-embeded.svg' added fix #1
Michal Maciola [Thu, 1 Jul 2021 08:44:15 +0000 (10:44 +0200)]
example svg: 'image-embeded.svg' added fix #1

Added png image with composition applied

3 years agoexample svg: 'image-embeded.svg' added
Michal Maciola [Thu, 1 Jul 2021 08:03:32 +0000 (10:03 +0200)]
example svg: 'image-embeded.svg' added

3 years agojpg_loader: change source file mode 664
Hermet Park [Fri, 9 Jul 2021 07:53:08 +0000 (16:53 +0900)]
jpg_loader: change source file mode 664

3 years agojpg_loader JpgLoader: Prevent memory leak
JunsuChoi [Fri, 9 Jul 2021 04:22:43 +0000 (13:22 +0900)]
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.

3 years agosvg_loader: <image> tag introduced fix #9
Michal Maciola [Thu, 8 Jul 2021 08:49:21 +0000 (10:49 +0200)]
svg_loader: <image> tag introduced fix #9

Fixed Base64 and utf8 for new line and whitespace
Changed tvgSvgLoaderCommon.h to single line convention

3 years agosvg_loader: <image> tag introduced fix #8
Michal Maciola [Tue, 6 Jul 2021 09:33:44 +0000 (11:33 +0200)]
svg_loader: <image> tag introduced fix #8

Disable embedded svg files to protect against recursive svg image loading

3 years agosvg_loader: <image> tag introduced fix #7
Michal Maciola [Mon, 5 Jul 2021 07:12:40 +0000 (09:12 +0200)]
svg_loader: <image> tag introduced fix #7

fixed auto and new lines in tvgSvgUtil.cpp

3 years agosvg_loader: <image> tag introduced fix #6
Michal Maciola [Fri, 2 Jul 2021 11:05:10 +0000 (13:05 +0200)]
svg_loader: <image> tag introduced fix #6

Moved file:// removing into _imageBuildHelper

3 years agosvg_loader: <image> tag introduced fix #5
Michal Maciola [Fri, 2 Jul 2021 09:22:26 +0000 (11:22 +0200)]
svg_loader: <image> tag introduced fix #5

Added copyAttr for image

3 years agosvg_loader: <image> tag introduced fix #4
Michal Maciola [Thu, 1 Jul 2021 08:59:44 +0000 (10:59 +0200)]
svg_loader: <image> tag introduced fix #4

fixed mistyped vw to w and vh to h

3 years agosvg_loader: <image> tag introduced fix #3
Michal Maciola [Thu, 1 Jul 2021 08:42:17 +0000 (10:42 +0200)]
svg_loader: <image> tag introduced fix #3

Added working composition

3 years agosvg_loader: <image> tag introduced fix #2
Michal Maciola [Thu, 1 Jul 2021 08:08:12 +0000 (10:08 +0200)]
svg_loader: <image> tag introduced fix #2

Removed #ifdef from tvgSvgSceneBuilder.cpp

3 years agosvg_loader: <image> tag introduced fix #1
Michal Maciola [Thu, 1 Jul 2021 07:59:36 +0000 (09:59 +0200)]
svg_loader: <image> tag introduced fix #1

Fixed href string deleting

3 years agosvg_loader: <image> tag introduced
Michal Maciola [Wed, 30 Jun 2021 17:08:38 +0000 (19:08 +0200)]
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

3 years agosvg_loader: fix gradient memory leak.
Hermet Park [Thu, 8 Jul 2021 11:05:24 +0000 (20:05 +0900)]
svg_loader: fix gradient memory leak.

@Issue: https://github.com/Samsung/thorvg/issues/548

3 years agosvg_loader: optimize memory usage.
Hermet Park [Thu, 8 Jul 2021 10:25:50 +0000 (19:25 +0900)]
svg_loader: optimize memory usage.

-- unnecessary memory fragmentation.

3 years agoexample: PictureJpg.cpp
Michal Maciola [Thu, 8 Jul 2021 13:50:21 +0000 (15:50 +0200)]
example: PictureJpg.cpp

Created an example for testing jpg loading

3 years agosw_engine renderer: fix memory leak.
Hermet Park [Thu, 8 Jul 2021 11:20:49 +0000 (20:20 +0900)]
sw_engine renderer: fix memory leak.

prepared compositors can be dangled if the rendering is not occured.

free them by doubl-checking in the destructor.

@Issue: https://github.com/Samsung/thorvg/issues/547

3 years agotest capi: complement scene test cases.
Hermet Park [Thu, 8 Jul 2021 08:52:10 +0000 (17:52 +0900)]
test capi: complement scene test cases.

3 years agotests capi: Add capi Scene TC.
jykeon [Fri, 2 Jul 2021 01:20:20 +0000 (10:20 +0900)]
tests capi: Add capi Scene TC.

3 years agosvg_loader: postpone cloneNode()
Michal Maciola [Wed, 7 Jul 2021 06:34:15 +0000 (08:34 +0200)]
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

3 years agoinfra: ++ jpg support meson message
Hermet Park [Wed, 7 Jul 2021 04:48:27 +0000 (13:48 +0900)]
infra: ++ jpg support meson message

3 years agojpg_loader: introduced jpg decode using libjpeg-turbo fix #1
Michal Maciola [Fri, 2 Jul 2021 08:23:13 +0000 (10:23 +0200)]
jpg_loader: introduced jpg decode using libjpeg-turbo fix #1

Added bool open(const char* data, uint32_t size, bool copy);

3 years agojpg_loader: introduced jpg decode using libjpeg-turbo
Michal Maciola [Fri, 2 Jul 2021 07:23:57 +0000 (09:23 +0200)]
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

3 years agosvg_loader: Support percentage unit of dash-array
JunsuChoi [Tue, 6 Jul 2021 01:39:00 +0000 (10:39 +0900)]
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

3 years agopng_loader: added open from memory
Michal Maciola [Fri, 2 Jul 2021 12:03:18 +0000 (14:03 +0200)]
png_loader: added open from memory

Added PngLoader::open(const char* data, uint32_t size, bool copy)
Changed variables visibility to private

3 years agosvg_loader: set the priority for the style attribute for stop properties
Mira Grudzinska [Tue, 29 Jun 2021 14:17:41 +0000 (16:17 +0200)]
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.

3 years agosvg_loader: set the higher priority of style attributes
Mira Grudzinska [Tue, 29 Jun 2021 12:30:56 +0000 (14:30 +0200)]
svg_loader: set the higher priority of style attributes

issue #515

3 years agocommon: code refactoring.
Hermet Park [Tue, 6 Jul 2021 02:13:16 +0000 (11:13 +0900)]
common: code refactoring.

remove unnecessary comments,
its field name is enough descriptive. (It has to be!)

3 years agotvg_loader: change values of flags
Mira Grudzinska [Thu, 24 Jun 2021 23:11:28 +0000 (01:11 +0200)]
tvg_loader: change values of flags

It's a middle stage leading to removing flags from the tvgBinaryDesc.h file
and use the corresponding enums from the thorvg.h file.

3 years agosw_engine fill: correct the range of opacity,
Hermet Park [Tue, 6 Jul 2021 01:43:36 +0000 (10:43 +0900)]
sw_engine fill: correct the range of opacity,

also some minor code refactors.

3 years agosvg_loader: fix dead loop on none digit char in stroke-dasharray fix #3
Michal Maciola [Sat, 3 Jul 2021 10:48:42 +0000 (12:48 +0200)]
svg_loader: fix dead loop on none digit char in stroke-dasharray fix #3

Added zero and negative value protection

3 years agosvg_loader: fix dead loop on none digit char in stroke-dasharray fix #2
Michal Maciola [Fri, 2 Jul 2021 18:10:02 +0000 (20:10 +0200)]
svg_loader: fix dead loop on none digit char in stroke-dasharray fix #2

Moved _skipComma at the begining of the loop

3 years agosvg_loader: fix dead loop on none digit char in stroke-dasharray
Michal Maciola [Fri, 2 Jul 2021 13:57:12 +0000 (15:57 +0200)]
svg_loader: fix dead loop on none digit char in stroke-dasharray

3 years agosw_engine: stop-opacity value should be interpolated between stops
Mira Grudzinska [Mon, 5 Jul 2021 22:28:10 +0000 (00:28 +0200)]
sw_engine: stop-opacity value should be interpolated between stops

The opacity value is interpolated as are all color channels.
It's similar to the reverted commit ac95433, but with two slight changes
(alpha_blend was missing in the ctable init and 'a' was used in an if
statement instead of 'a2').

3 years agoinfra: enable capi unit-test in default
Hermet Park [Sat, 3 Jul 2021 06:36:01 +0000 (15:36 +0900)]
infra: enable capi unit-test in default

3 years agotest filling: add fill/linear/radial gradients.
Hermet Park [Sat, 3 Jul 2021 16:23:18 +0000 (01:23 +0900)]
test filling: add fill/linear/radial gradients.

3 years agocommon linear_gradient: fix to allow zero size linear.
Hermet Park [Sat, 3 Jul 2021 16:36:51 +0000 (01:36 +0900)]
common linear_gradient: fix to allow zero size linear.

We can't judge zero size gradient is error case.
Non-filled linear is possibly intended by calculation.

3 years agotest capi: code refactoring
Hermet Park [Sat, 3 Jul 2021 07:47:09 +0000 (16:47 +0900)]
test capi: code refactoring

use catch Approx functions to compare floating-point values.

3 years agocommon picture: fix invalid size returns from raw image.
Hermet Park [Sat, 3 Jul 2021 07:09:56 +0000 (16:09 +0900)]
common picture: fix invalid size returns from raw image.

picture/raw should update the size if the raw image
with size values are entered.

3 years agotest picture: ++ raw data loading.
Hermet Park [Sat, 3 Jul 2021 06:56:38 +0000 (15:56 +0900)]
test picture: ++ raw data loading.

3 years agotest capi: add Picture unit test
Hermet Park [Sat, 3 Jul 2021 06:28:14 +0000 (15:28 +0900)]
test capi: add Picture unit test

3 years agoinfra: print enabled features in the meson summary list.
Hermet Park [Sat, 3 Jul 2021 05:58:17 +0000 (14:58 +0900)]
infra: print enabled features in the meson summary list.

instead removed individual messages.

3 years agosvg_loader: multiple composition memory leak
Michal Maciola [Thu, 1 Jul 2021 09:29:22 +0000 (11:29 +0200)]
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.

3 years agosvg_loader: memory leak after improper stop tag fix #1
Michal Maciola [Fri, 2 Jul 2021 08:38:21 +0000 (10:38 +0200)]
svg_loader: memory leak after improper stop tag fix #1

Updated printf message

3 years agosvg_loader: memory leak after improper stop tag
Michal Maciola [Thu, 1 Jul 2021 10:32:28 +0000 (12:32 +0200)]
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.

3 years agoinfra: just released v0.3.0
Hermet Park [Sat, 3 Jul 2021 04:08:50 +0000 (13:08 +0900)]
infra: just released v0.3.0

3 years agotest Picture: add Picture unit tests
Hermet Park [Fri, 2 Jul 2021 02:24:37 +0000 (11:24 +0900)]
test Picture: add Picture unit tests

3 years agocommon picture: ++exception case.
Hermet Park [Fri, 2 Jul 2021 03:40:39 +0000 (12:40 +0900)]
common picture: ++exception case.

Fixed load() to return InvalidArgument if the file path is invalid.

3 years agosvg_loader SvgPath: Added corner case handling for flags of Arc
JunsuChoi [Fri, 2 Jul 2021 02:14:56 +0000 (11:14 +0900)]
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.

3 years agoinfra: ++ strict build test
Hermet Park [Fri, 2 Jul 2021 03:04:08 +0000 (12:04 +0900)]
infra: ++ strict build test

Enable png loader in default.

3 years agocommon picture: ++ exception case.
Hermet Park [Fri, 2 Jul 2021 02:37:35 +0000 (11:37 +0900)]
common picture: ++ exception case.

size() returns InsufficientCondition if it doesn't have any loaded data.

3 years agotest Shape: add Shape unit tests
Hermet Park [Fri, 2 Jul 2021 01:38:28 +0000 (10:38 +0900)]
test Shape: add Shape unit tests

3 years agocommon shape: allow to reset stroke dash.
Hermet Park [Thu, 1 Jul 2021 11:04:30 +0000 (20:04 +0900)]
common shape: allow to reset stroke dash.

user may need to reset stroke dash to off,
now stroke api allows it.

3 years agofix build break. accepted/tizen/unified/20210705.125141 submit/tizen/20210703.045735
Hermet Park [Sat, 3 Jul 2021 04:47:54 +0000 (13:47 +0900)]
fix build break.

This is a temporary fix for dali-integration.

Change-Id: I8204612b62dbe7f86f73e1cd8d6ceebc53e12e08

3 years agobump up version v0.2.2 27/260727/1 submit/tizen/20210702.111011
Hermet Park [Fri, 2 Jul 2021 01:52:32 +0000 (10:52 +0900)]
bump up version v0.2.2

Change-Id: Iddbdbfa6480c12f40a7b53516fba255184f52379

3 years agotest scene: revert section usage.
Hermet Park [Thu, 1 Jul 2021 11:34:27 +0000 (20:34 +0900)]
test scene: revert section usage.

Dismiss this usage for consistency.

Yet we have no practical necessity,
we can apply this to *all test suites later.

Change-Id: I382f9df4bea65063a4351f2fa9aebe9d7f2008b5

3 years agoRevert "svg_loader SvgPath: Added corner case handling for flags of Arc"
Hermet Park [Thu, 1 Jul 2021 09:01:29 +0000 (18:01 +0900)]
Revert "svg_loader SvgPath: Added corner case handling for flags of Arc"

This reverts commit 5da4c8113803de9068aa7a1c495b7bddfc530cf4.

Please double-check this regression bug:

examples/images/samsung-galaxy-s.svg

Change-Id: I0c1991fdae15b44979c81458e46522fefde37c26

3 years agosw_engine: --sanitizer errors
Hermet Park [Thu, 1 Jul 2021 08:51:10 +0000 (17:51 +0900)]
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

Change-Id: Id6b1cd6bae263ac413fd4c198dc905312b9def26

3 years agocommon array: -- sanitizer errors
Hermet Park [Thu, 1 Jul 2021 08:38:34 +0000 (17:38 +0900)]
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

Change-Id: I4a584f715cc71a7c0aeca921586e6b8f1fa1a7fe

3 years agoRevert "sw_engine: stop-opacity value should be interpolated between stops"
Hermet Park [Thu, 1 Jul 2021 08:34:59 +0000 (17:34 +0900)]
Revert "sw_engine: stop-opacity value should be interpolated between stops"

This reverts commit ac95433b53f5fd4a375b7d1952694f17eeda3d0f.

Ahh this breaks examples/images/rg1024_eggs.svg

Change-Id: Id73d4d0ce976de8a6c3f2ca198e7510e78e2838f

3 years agoupdate CONTRIBUTING
Hermet Park [Thu, 1 Jul 2021 03:59:02 +0000 (12:59 +0900)]
update CONTRIBUTING

Change-Id: I22d407a2fd88cdf3dc275e71c7646e670ea55639

3 years agoUpdate CONTRIBUTING.md
Hermet Park [Thu, 1 Jul 2021 03:50:09 +0000 (12:50 +0900)]
Update CONTRIBUTING.md

Change-Id: I61acd2972bd62640d75fbb1309a32c91be473f2c

3 years agores: updated images
Hermet Park [Thu, 1 Jul 2021 03:26:52 +0000 (12:26 +0900)]
res: updated images

Change-Id: I1bb0f49832e29ddfddeaea5528e3c78cadcdb40a

3 years agosvg_loader: recalculating the default values of grads
Mira Grudzinska [Fri, 25 Jun 2021 11:53:00 +0000 (13:53 +0200)]
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.

Change-Id: Iff7edabe33b77593bd74c89e9d9c7efdedcfb381

3 years agosw_engine: fix broken MSVC compatibility.
Hermet Park [Thu, 1 Jul 2021 03:01:27 +0000 (12:01 +0900)]
sw_engine: fix broken MSVC compatibility.

error: use of undeclared identifier 'ulong'

@Issue: https://github.com/Samsung/thorvg/issues/541

Change-Id: Ic0554c2e0160d46c0762b619a62a7eddabcf3743

3 years agosw_engine: stop-opacity value should be interpolated between stops
Mira Grudzinska [Tue, 29 Jun 2021 22:21:48 +0000 (00:21 +0200)]
sw_engine: stop-opacity value should be interpolated between stops

The opacity value is interpolated as are all color channels.

Change-Id: Ib7cf0d33cc354b23d6afa406e50d6ff9b001966a

3 years agosvg_loader: allow multiple <defs> tags without data and memory leak (#528)
Michal Maciola [Wed, 30 Jun 2021 08:21:30 +0000 (10:21 +0200)]
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.

Change-Id: Iada1c467949228e116a637c8fd37ceabb5dc34bb

3 years agosvg_loader: fix a infinite loop error by circular dependency.
Hermet Park [Wed, 30 Jun 2021 06:27:25 +0000 (15:27 +0900)]
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

Change-Id: I9bddf19b1da5317109533260f336cdea54294620

3 years agoinfra: ++ strict build test
Hermet Park [Wed, 30 Jun 2021 06:15:00 +0000 (15:15 +0900)]
infra: ++ strict build test

Enable log in default.

Change-Id: I3cc0f7debbebb281fe90c2ddb5a4baaaccfba8b3

3 years agosvg_loader: code refactoring
Hermet Park [Wed, 30 Jun 2021 05:16:27 +0000 (14:16 +0900)]
svg_loader: code refactoring

unify to tvg fill rule.

Change-Id: Ia6cd5d8e64aab410409492f03177322e2073a968

3 years agosvg_loader: recover partial code from 3e7888b5387a57568c558afc59526d5e672e1859
Hermet Park [Wed, 30 Jun 2021 06:12:15 +0000 (15:12 +0900)]
svg_loader: recover partial code from 3e7888b5387a57568c558afc59526d5e672e1859

oops, log was not tested in the patch...

Change-Id: Ia607f4b6095a370c18de9be65c31cbe9f77be15e

3 years agosvg_loader: code refactoring
Hermet Park [Wed, 30 Jun 2021 05:09:09 +0000 (14:09 +0900)]
svg_loader: code refactoring

remove more unused declarations...

Change-Id: I856ddc02892afe3877303134fb65325206eac594

3 years agosvg_loader: code refactoring
Hermet Park [Wed, 30 Jun 2021 04:58:58 +0000 (13:58 +0900)]
svg_loader: code refactoring

use color structure to keep neat & compact code.

Change-Id: I82ffc31f774961f3ecc4c1c305222811434f360d

3 years agosvg_loader: code refactoring
Hermet Park [Wed, 30 Jun 2021 04:44:37 +0000 (13:44 +0900)]
svg_loader: code refactoring

remove unused declaration.

Change-Id: I8ed7f5182c7d2f811f8faab06fc6161807a72ee6

3 years agosvg_loader: fix the inifite loop bug when size has 'em' unit.
Hermet Park [Tue, 29 Jun 2021 11:13:03 +0000 (20:13 +0900)]
svg_loader: fix the inifite loop bug when size has 'em' unit.

svg may have 'em' unit for fonts, strtof() must handle this case to not
drop in the infinite loop.

Yet thorvg doesn't support font feature in svg,
it must multiply values with font size if those values have 'em' size.

@Issue: https://github.com/Samsung/thorvg/issues/488

Change-Id: I07f3bcb7d177420739e3804d01b3d2e7492d457f

3 years agosw_engine rle: -- sanitizer reports.
Hermet Park [Tue, 29 Jun 2021 06:51:50 +0000 (15:51 +0900)]
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

Change-Id: I05578fa69435b70f66340ead7373629a81925fc3

3 years agosw_engine renderer: fix a broken composition bug
Hermet Park [Tue, 29 Jun 2021 05:23:38 +0000 (14:23 +0900)]
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

Change-Id: I09ba606b2e6c0c5f4750c9e8810b74c705851b63

3 years agoMerge "temporary fix for abi break." into tizen
Hermet Park [Tue, 29 Jun 2021 02:42:25 +0000 (02:42 +0000)]
Merge "temporary fix for abi break." into tizen

3 years agosvg_loader: currentColor - inheritance from a parent
Mira Grudzinska [Sun, 27 Jun 2021 14:07:24 +0000 (16:07 +0200)]
svg_loader: currentColor - inheritance from a parent

The 'currentColor' attribute value was not inherited. Fixed.

3 years agosvg_loader: negative attrs length fix
Michal Maciola [Fri, 25 Jun 2021 15:36:00 +0000 (17:36 +0200)]
svg_loader: negative attrs length fix

After finding no attributes but white spaces, attrs length could be negative
that resulted in segmentation fault in simpleXmlParseAttributes function.

@Issue: #487

3 years agosvg_loader: fix trivial build warnings.
Hermet Park [Mon, 28 Jun 2021 04:38:12 +0000 (13:38 +0900)]
svg_loader: fix trivial build warnings.

../src/loaders/svg/tvgSvgLoader.cpp: In function ‘void _copyAttr(SvgNode*, const SvgNode*)’:
../src/loaders/svg/tvgSvgLoader.cpp:1598:60: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct SvgStyleProperty’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
     memcpy(to->style, from->style, sizeof(SvgStyleProperty));

@Issue: 498