Commit graph

913 commits

Author SHA1 Message Date
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
Hermet Park
ca86907739 common: code refactoring.
remove unnecessary comments,
its field name is enough descriptive. (It has to be!)
2021-07-06 11:13:54 +09:00
Mira Grudzinska
795e520404 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.
2021-07-06 11:07:10 +09:00
Hermet Park
925b9c8ba9 sw_engine fill: correct the range of opacity,
also some minor code refactors.
2021-07-06 10:44:56 +09: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
Mira Grudzinska
a40d3f6fd7 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').
2021-07-06 10:33:02 +09:00
Hermet Park
0d9edfd64c infra: enable capi unit-test in default 2021-07-06 09:43:47 +09:00
Hermet Park
547920d324 test filling: add fill/linear/radial gradients. 2021-07-04 01:44:34 +09:00
Hermet Park
15d6a51527 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.
2021-07-04 01:36:51 +09:00
Hermet Park
a5d2950902 test capi: code refactoring
use catch Approx functions to compare floating-point values.
2021-07-03 16:51:50 +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
64b25bb35b test picture: ++ raw data loading. 2021-07-03 16:15:57 +09:00
Hermet Park
009c475fc9 test capi: add Picture unit test 2021-07-03 15:34:43 +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
Hermet Park
935b8592f1 infra: just released v0.3.0 2021-07-03 13:08:50 +09:00
Hermet Park
10f80fa832 test Picture: add Picture unit tests 2021-07-02 14:02:09 +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
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
1b94ff63ef infra: ++ strict build test
Enable png loader in default.
2021-07-02 12:07:53 +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
27cac72d7d
test Shape: add Shape unit tests 2021-07-02 10:38:28 +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
97302d2983 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.
2021-07-01 20:41:07 +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
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
397becee46 update CONTRIBUTING 2021-07-01 12:59:20 +09:00
Hermet Park
cf2b0c4620
Update CONTRIBUTING.md 2021-07-01 12:50:09 +09:00
Hermet Park
870948ea32 res: updated images 2021-07-01 12:26:52 +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
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
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
bb68a2d514 infra: ++ strict build test
Enable log in default.
2021-06-30 15:18:40 +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
Hermet Park
6a79d2c06e 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
2021-06-30 11:27:31 +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