Commit graph

879 commits

Author SHA1 Message Date
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
Hermet Park
c31156e737 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
2021-06-29 14:44:09 +09:00
Mira Grudzinska
feb71ff36c svg_loader: currentColor - inheritance from a parent
The 'currentColor' attribute value was not inherited. Fixed.
2021-06-29 09:27:52 +09:00
Michal Maciola
520d6e7bbd 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
2021-06-28 16:46:26 +09:00
Hermet Park
78bb8d1f2e 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
2021-06-28 13:47:15 +09:00
Mira Grudzinska
57a22b8462 svg_loader: finish the search after founding the proper color
In the _toColor func, after founding the proper color, the search
should be finiched.
2021-06-28 11:32:44 +09:00
Mira Grudzinska
f477933098 svg_loader: applying opacity to the gradient
Before this change the 'stroke-opacity' and the 'fill-opacity'
grad style attributes were not taken into account.
2021-06-28 10:34:14 +09:00
Mira Grudzinska
6eea979dae common: introducing the composite API (getter)
The new API gets the composite method and the pointer to the composite
target of the given paint object.
2021-06-25 22:16:06 +09:00
Mira Grudzinska
96d6b47a64 common: PaintType enum changed to identifier in Paint class
The PaintType enum was used to set the paint type in the internal Paint
implementation. This solution is switched to an identifier with id() getter,
so that the information about the type can be reached from outside the Paint.
2021-06-25 22:13:20 +09:00
Hermet Park
bf39e0fea9
Update README.md
@mgrudzinska I don't know this makes you understand, you can suggest if you have a better phrase.
2021-06-25 10:49:08 +09:00
K. S. Ernest (iFire) Lee
affa809a2c Use spellcheck 2021-06-25 10:43:34 +09:00
Hermet Park
a6f9ec3080 svg_loader: fix memory violation issues.
copy attribute must copy the url data,
otherwise, url memory can be atempted freeing twice.

also, fix the memory leak in multiple composition case.
2021-06-25 10:28:27 +09:00
Hermet Park
940b8b566f
Update README.md 2021-06-24 23:02:32 +09:00
Mira Grudzinska
286f700305 svg_loader: handling the ColorStop offset values
The ColorStop offset < 0 and > 1 should be treated as 0 and 1 respectively.
The offset value < than the previous offset value should be replaced
by the previous value - without this change segfault occurred.
Validating the APIs parameters values is the user responsibility.
2021-06-24 20:54:03 +09:00
Hermet Park
750ad90bf0 sw_engine stroke: set stroke invalid if points are zero.
This valid tag is used for further progress.
we don't need it actually since we can count by points number.
2021-06-24 20:50:37 +09:00
Hermet Park
86fd0f67cf svg_loader: prevent heap memory overflow.
if the input points are odd-numberd by invalid svg data, it could access invalid memory.

Prevents it just in case.
2021-06-24 16:54:07 +09:00
JunsuChoi
5da4c81138 svg_loader SvgPath: Added corner case handling for flags of Arc
It handles the case what the flag of the arc of the path is defined
without spaces or commas, such as 00, 01, 11 or 10.
2021-06-24 08:52:30 +02:00
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