Mira Grudzinska
afee0441f6
svg_loader: removed unnecessary header
2023-08-01 14:53:36 +02:00
Mira Grudzinska
4f9f125454
svg_loader: update style in defs
...
In the defs node the style was not updated, hence
the inheritance wasn't applied causing wrong results.
2023-07-28 12:11:24 +09:00
Mira Grudzinska
b0e41b2b9f
svg_loader: support the '!important' directive
...
The directive is used to give a specific style property
higher priority, ensuring that it overrides other style
declarations for the same property.
@Issue: https://github.com/thorvg/thorvg/issues/1255
2023-07-27 11:51:45 +09:00
Hermet Park
60f81b7da7
loader lottie: added empty interface body
...
This marks the first step towards implementing the Lottie feature.
2023-07-27 00:31:27 +09:00
Mira Grudzinska
de41853bcf
svg_loader: custom strndup moved into utils
...
The custom _strndup was used only in one file
as an internal function and wasn't accessible
in other parts of the code. Now function
is available as svgUtilStrndup.
2023-07-26 00:21:56 +09:00
Hermet Park
a1f0b06f41
common array: revise code.
...
maintain code with an optimial size.
2023-07-25 19:57:12 +09:00
Hermet Park
accb8c5699
svg loader: --compiler warnings
...
../src/loaders/svg/tvgSvgLoader.cpp: In function ‘void _copyAttr(SvgNode*, const SvgNode*)’:
../src/loaders/svg/tvgSvgLoader.cpp:2911:44: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
2911 | if (to->node.polygon.pts.count = from->node.polygon.pts.count) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/loaders/svg/tvgSvgLoader.cpp:2917:45: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
2917 | if (to->node.polyline.pts.count = from->node.polyline.pts.count) {
2023-07-04 01:17:25 +09:00
Hermet Park
d72d6aa51f
loader svg: code cleanup
...
Use array instead of individual dynamic array implementation.
This also fixes wrong polygon & polyline data access during copy & paste...
2023-07-04 01:09:23 +09:00
Martin Capitanio
44a750ee5d
API, CAPI, sw_engine: add suport for stroke-miterlimit.
2023-06-13 10:42:20 +09:00
Hermet Park
f2fdc380b4
fix compiler warnings on MacOS
...
warning: unqualified call to 'std::move' [-Wunqualified-std-cast-call]
2023-05-19 10:56:59 +09:00
Mira Grudzinska
2cfa5505c3
svg_loader: fixing finding defs node
...
In the case when a 'use' node was used
in a 'defs' block and the element it
referenced was also defined within the same
'defs' block, the reference node could not
be cloned. This was because the 'defs' node
could not be located.
@Issue: https://github.com/thorvg/thorvg/issues/1451
2023-05-16 10:43:45 +09:00
Mira Grudzinska
40ef9031ba
svg_loader: copy the use node properties
...
A bug was observed when a 'use' node was
referenced in another 'use' node.
@Issue: https://github.com/thorvg/thorvg/issues/1451
2023-05-16 10:42:35 +09:00
Mira Grudzinska
4599067bee
svg_loader: fixing percent. calculations of width/height
...
The conversion to percentages was applied twice.
Additionally, when a viewbox value was provided before the width/height,
incorrect scaling occurred.
@Issue: https://github.com/thorvg/thorvg/issues/1414
2023-05-04 09:52:55 +09:00
Hermet Park
9a9c0e7907
svg_loader: code refactoring.
...
simplify the logic and remove unnecessary member data.
2023-05-03 22:08:16 +09:00
Hermet Park
f82c274444
svg_loader: fix memory violation.
...
LoadModule data is designed to be returned to the user's call.
and should not be writable in Task::run()
@Issue: https://github.com/thorvg/thorvg/issues/1409
2023-05-03 22:08:16 +09:00
Mira Grudzinska
92346c4119
svg_loader: handling svg width/height in percentages
...
The percentages should refer to the size of the viewbox.
This was not the case for not knowing the viewbox before
reading the width/height.
@Issue: https://github.com/thorvg/thorvg/issues/1409
2023-05-03 20:35:08 +09:00
Hermet Park
1e370712e0
loader svg: ++code readability
...
Use own bit operation helpers.
2023-04-26 11:15:48 +09:00
Mira Grudzinska
83ffe9f612
svg_loader: fixing grad overwritting
...
Gradient was mistakenly overwritten in
files in which the <def> section existed,
but grad was defined outside it.
2023-04-25 14:30:23 +09:00
Mira Grudzinska
74c9a5f795
svg_loader: changed update order
...
The gradient was updated before the style,
which resulted in only the URL tag being
inherited, but the gradient itself was not
applied to the node.
2023-04-25 09:01:19 +09:00
Mira Grudzinska
219e23855f
svg_loader: paint-order attrib handled
...
@Issue: https://github.com/thorvg/thorvg/issues/1340
2023-04-18 22:21:55 +09:00
Mira Grudzinska
f089b77a45
svg_loader: fixing parsing empty elements
...
Self-closing tags (empty elements) were parsed until
the appearance of the '>' character, causing the '/'
char to be appended to the tag name. The final '/'
char should be omitted.
2023-04-17 09:57:52 +09:00
Mira Grudzinska
598c28a597
svg_loader: gradient inheritance implemented
...
Till now only the grad stops were inherited. Now all
grad attribs are.
Inheritance from different grad type is not supported.
@Issue: https://github.com/thorvg/thorvg/issues/1209
2023-04-15 17:43:42 +09:00
Mira Grudzinska
66ef84e7d7
svg_loader: code refactoring
...
Changed order of functions - needed in the grad
inheritance commit.
2023-04-15 17:43:42 +09:00
Mira Grudzinska
c7137a8105
svg_loader: forcing file loading completion
...
Svgs without any viewbox and width/height information
have to be loaded before any other action is taken.
This is necessary to get the valid sive/viewbox info.
2023-03-31 09:48:01 +02:00
Mira Grudzinska
be361221df
svg_loader: handling zero width/height viewbox
...
For svgs with the width and/or height value set to zero
rendering was disabled - the load api return Result:Unknown
and draw - Result::InsufficientCondition.
Now an empty scene is added, so that both, load and draw,
return Result::Success.
2023-03-21 11:11:45 +09:00
Mira Grudzinska
9e8980a1f7
svg_loader: handling svgs without viewBox/viewPort
...
Additionally:
- cases of inforrect viewBox values are handled
- cases of zero width/height of a viewBox and/or viewPort
@Issue: https://github.com/Samsung/thorvg/issues/1239
2023-03-21 11:11:45 +09:00
Hermet Park
9b3c34c3b1
updated copyright.
2023-01-14 13:48:11 +09:00
Mira Grudzinska
df9a28bf0a
svg_loader: fixing name
...
_parserColor -> _parseColor
2023-01-07 10:52:56 +09:00
JunsuChoi
abb9df7c6b
svg_loader: Change SVG viewbox variable type from int to float
...
The viewbox and size(width, height) defined in SVG can be of type float.
This prevents matrix calculation errors caused by this.
2022-12-12 23:48:52 +09:00
Hermet Park
93b88370ad
svg loader: remove unused logic.
...
Please keep it simple and easy.
Don't leave a chance compiler warn it.
2022-09-02 12:02:39 +09:00
Mira Grudzinska
3939b61770
svg_loader: preserveAspectRatio attrib handled according to the svg standard ( #1249 )
...
* svg_loader: preserveAspectRatio attrib handled according to the svg standard
* svg_loader: symbol fixed
The correct width/height values used in the _useBuildHelper function.
Bug was propageted while the preserveAspectRatio attrib was handled,
now fixed.
* svg_loader: refactoring code regarding the preserveAspectRatio attrib
To avoid copy/paste a new function is introduced to handle the proper
scaling.
* svg_loader: initialize the svg loader members
The 'align' and 'meetOrSlice' svg loader members were not initialized.
* svg_loader: resize function forces any transformation
The resize function is called after the svg image is read and scaled
taking into account the proper preserveAspectRatio value. While resizing
the preserveAspectRatio isn't checked any more and the image can be
freely transformed.
2022-09-02 11:59:49 +09:00
Mira Grudzinska
c93c2d3100
svg_loader: deeper search for postponed nodes
...
Till now the proper node was searched only among children,
now all the nodes are checked.
2022-09-02 11:15:08 +09:00
Mira Grudzinska
be4f382d99
svg_loader: prevent mem leaks
...
A necessary check added before strdup function is called
2022-08-31 11:27:37 +09:00
JunsuChoi
b24e7c7402
svg_loader: Remove unnecessary code
2022-08-30 23:31:25 +02:00
JunsuChoi
eb936d1a81
svg_loader: If there is already set color url, it will be deleted.
...
When setting the url for color, if there is an already set url,
it will be overwritten after deletion. This prevents memory leaks.
asan result)
Direct leak of 2 byte(s) in 1 object(s) allocated from:
#0 0x7ff1d547bc68 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10bc68)
#1 0x7ff1d4e435b4 in _idFromUrl ../src/loaders/svg/tvgSvgLoader.cpp:327
#2 0x7ff1d4e44a8e in _toColor ../src/loaders/svg/tvgSvgLoader.cpp:558
#3 0x7ff1d4e42ee9 in _parseStyleAttr ../src/loaders/svg/tvgSvgLoader.cpp:1033
#4 0x7ff1d4e7f092 in simpleXmlParseAttributes(char const*, unsigned int, bool (*)(void*, char const*, char const*), void const*) ../src/loaders/svg/tvgXmlParser.cpp:361
#5 0x7ff1d4e597d3 in _createPathNode ../src/loaders/svg/tvgSvgLoader.cpp:1363
#6 0x7ff1d4e61359 in _svgLoaderParserXmlOpen ../src/loaders/svg/tvgSvgLoader.cpp:2723
#7 0x7ff1d4e61c49 in _svgLoaderParser ../src/loaders/svg/tvgSvgLoader.cpp:2801
#8 0x7ff1d4e7f3f6 in simpleXmlParse(char const*, unsigned int, bool, bool (*)(void*, SimpleXMLType, char const*, unsigned int), void const*) ../src/loaders/svg/tvgXmlParser.cpp:429
#9 0x7ff1d4e639a1 in SvgLoader::run(unsigned int) ../src/loaders/svg/tvgSvgLoader.cpp:3121
#10 0x7ff1d4dc8b75 in tvg::Task::operator()(unsigned int) ../src/lib/tvgTaskScheduler.h:68
#11 0x7ff1d4dc8b75 in tvg::TaskSchedulerImpl::run(unsigned int) ../src/lib/tvgTaskScheduler.cpp:138
#12 0x7ff1d4dc98f7 in tvg::TaskSchedulerImpl::TaskSchedulerImpl(unsigned int)::{lambda()#1}::operator()() const ../src/lib/tvgTaskScheduler.cpp:113
#13 0x7ff1d4dc98f7 in void std::__invoke_impl<void, tvg::TaskSchedulerImpl::TaskSchedulerImpl(unsigned int)::{lambda()#1}>(std::__invoke_other, tvg::TaskSchedulerImpl::TaskSchedulerImpl(unsigned int)::{lambda()#1}&&) /usr/include/c++/9/bits/invoke.h:60
#14 0x7ff1d4dc98f7 in std::__invoke_result<tvg::TaskSchedulerImpl::TaskSchedulerImpl(unsigned int)::{lambda()#1}>::type std::__invoke<tvg::TaskSchedulerImpl::TaskSchedulerImpl(unsigned int)::{lambda()#1}>(std::__invoke_result&&, (tvg::TaskSchedulerImpl::TaskSchedulerImpl(unsigned int)::{lambda()#1}&&)...) /usr/include/c++/9/bits/invoke.h:95
#15 0x7ff1d4dc98f7 in void std:🧵 :_Invoker<std::tuple<tvg::TaskSchedulerImpl::TaskSchedulerImpl(unsigned int)::{lambda()#1}> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/include/c++/9/thread:244
#16 0x7ff1d4dc98f7 in std:🧵 :_Invoker<std::tuple<tvg::TaskSchedulerImpl::TaskSchedulerImpl(unsigned int)::{lambda()#1}> >::operator()() /usr/include/c++/9/thread:251
#17 0x7ff1d4dc98f7 in std:🧵 :_State_impl<std:🧵 :_Invoker<std::tuple<tvg::TaskSchedulerImpl::TaskSchedulerImpl(unsigned int)::{lambda()#1}> > >::_M_run() /usr/include/c++/9/thread:195
#18 0x7ff1d3a344bf (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd44bf)
example)
<svg height="400" width="600" xmlns:xlink="http://www.w3.org/1999/xlink " xmlns="http://www.w3.org/2000/svg ">
<defs>
<radialGradient r="12" fy="10" fx="10" cy="10" cx="10" id="i" xlink:href="#d"/>
<clipPath id="g" clipPathUnits="userSpaceOnUse">
<path d="M0 10 10z" style="marker:none" fill="#fff" stroke-width="2"/>
</clipPath>
</defs>
<path d="M0 10 Z" fill="url(#g)" style="fill:url(#i);fill-opacity:1"/>
</svg>
2022-08-30 23:31:25 +02:00
Mira Grudzinska
092a53b0aa
svg_loader: fill and stroke paiint url were copied twice
...
The url were copied in the _copyAttr and in the _styleCopy
functions.
2022-08-29 12:00:35 +09:00
Mira Grudzinska
e36368c40c
svg_loader: only the first css style node is interpreted
...
Since the css id selector is not supported in TVG, only the first
style node is taken into account.
2022-08-29 11:59:32 +09:00
mgrudzinska
0da0f5fa46
svg_loader: clearing the parser stop flags
2022-04-05 20:07:33 +09:00
mgrudzinska
eb7b281898
svg_loader: fixing color parsing
...
Color given in percentages, ex."rgb(10%,20%,30%)", was incorrectly parsed.
2022-04-05 19:36:15 +09:00
mgrudzinska
470b885e65
svg_loader: fixing segf when passing a nullptr to strcmp
...
This occurred when a gradient has no 'id' attribute.
2022-04-03 22:42:26 +02:00
mgrudzinska
1e8b8cbb53
svg_loader: symbol node without any viewbox/width/height info handled properly
2022-03-21 18:38:10 +09:00
Mira Grudzinska
2ee25ea11d
svg_loader: width and height attribs of the use element applied
2022-03-07 11:32:02 +09:00
Hermet Park
bdda2586e9
svg_loader: handle the exception properly.
...
viewBox doesn't expect the missing attributes,
it won't have any default values.
So we can decide the fault when the values are missed.
2022-02-23 15:02:17 +09:00
Mira Grudzinska
72ab9268e3
svg_loader: symbol++
...
- The initial value of the overflow attribute was missing
- overflow="visible" was missing scaling
2022-02-21 11:21:22 +09:00
Mira Grudzinska
70ed0653f1
svg_loader: symbol tag implemented
...
The 'symbol' tag introduced. It can be used to define graphical
template objects which can be instantiated by a 'use' tag.
2022-02-21 11:21:22 +09:00
Mira Grudzinska
23ea4ed9f1
svg_loader: fixing memory leak
...
The css style node was improperly freed.
2022-02-14 14:35:09 +09:00
Mira Grudzinska
87832a9236
svg_loader: preventing invalid log msg
2022-02-09 19:52:35 +01:00
Mira Grudzinska
6a589777b0
svg_loader: proper image transformation
...
One of the image's attributes can be a transformation matrix.
Now it's applied.
2022-02-08 19:49:39 +09:00
Hermet Park
ff3ebd9abd
svg_loader: code refactoring.
...
follow strict coding-style.
no logic changes.
2022-02-08 18:57:11 +09:00
Mira Grudzinska
1aaf222b62
svg_loader: fixing css style for group selectors, clips/masks
...
The css styling has to be applied as the first step of the node
updates. Whereas the updateStyle function should be called
as the last step, after all other node updates are made.
2022-02-08 17:58:53 +09:00