Mira Grudzinska
6fb0984b49
svg_loader: postponed nodes properly cloned
...
In case when no defs tag was used, no child node was found.
Also the node attributes should not override those set in the ancestor.
2022-01-12 09:54:57 +01:00
Hermet Park
f0141e63de
updated copyright date.
2022-01-12 14:08:48 +09:00
Mira Grudzinska
2217b94361
svg_loader: changed the order of if conditions
...
The weekest condition should be checked as the last one.
Otherwise CDATA marker was never found.
2022-01-11 14:05:00 +09:00
Mira Grudzinska
baf45823cb
svg_loader: the color attribute properly inherited
...
The color attribute hat to be inherited regardles whether it is used
in the child node or not - it may be used i.e. in the grandchild node.
2022-01-11 14:04:39 +09:00
Mira Grudzinska
4b0037fe6a
svg_loader: removing repeated lines
...
The clip-path and the mask attributes are both parsed in _attrParseGNode
function, which is called in th _attrParseUseNode.
2022-01-11 14:03:33 +09:00
Mira Grudzinska
333ff25c7e
svg_loader: fix grad update
...
The grad update should be handled after the postponed nodes are cloned.
2022-01-11 13:56:14 +09:00
Mira Grudzinska
1f6c236fa3
svg_loader: preventing memory leak
...
A memory leak occured when the 'id' attribute was given multiple times
for a given gradient element. Fixed.
2022-01-11 13:55:21 +09:00
Mira Grudzinska
e409bb2984
svg_loader: LumaMask used only for masks other than white
...
For the performance reasons, the LumaMask is used only when
it's necessary - when the mask color is other than white.
Otherwise the AlphaMask is enough.
2022-01-08 02:26:52 +01:00
Mira Grudzinska
d3053777a8
svg_loader: typo fixed
...
_svgLoaderParerXmlClose -> _svgLoaderParserXmlClose
2022-01-08 00:39:21 +01:00
Mira Grudzinska
2f7e7e9923
svg_loader: mask-type attribute introduced
...
In an svg file the mask-type attribute can be specified.
It takes one of the two values: Luminosity or Alpha.
After the LumaMask is introduced into TVG, this attribute can be
properly read by the svg loader.
2022-01-07 12:45:34 +09:00
Hermet Park
1f5b66c256
svg_loader: ++robustness
...
prevent a crash with an exceptional handling.
@Issue: https://github.com/Samsung/thorvg/issues/1131
2022-01-06 13:40:00 +09:00
Mira Grudzinska
a6781734dc
svg_loader: composite node splitted on mask and clip nodes
...
The SvgCompositeNode is replaced by the SvgMaskNode and SvgClipNode.
This is needed for using Luma/AlphaMask in the svg loader and in the future,
when we introduce other mask's features.
2022-01-03 12:30:01 +09:00
Mira Grudzinska
4485db4f15
svg_loader: a function to establish shapes boundries without a stroke introduced
...
To handle the objectBoundingBox units, the shape's boundaries have to be known.
According to the SVG standard, a stroke shouldn't be taken into account. Since
the bounds() api uses the shape's stroke information, a new function is introduced,
that compensates this and returns boundaries without any strokes.
2021-11-26 11:47:15 +01:00
Mira Grudzinska
bd7c19a592
svg_loader: struct used to pass 1 args instead of 4 of them
...
The Box struct is introduced to replace the four functions
args: vx, vy, vw, vh, so all of them can be passed at once.
2021-11-26 11:47:15 +01:00
jykeon
bfaf26d99e
svg_loader: Add nullptr check.
...
Signed-off-by: jykeon <jykeon@samsung.com>
2021-11-19 17:37:45 +09:00
Hermet Park
0fcdba8a4b
common math: code refactoring
...
introduced mathZero(), mathEqual() for floating variables.
2021-11-15 17:10:54 +09:00
Mira Grudzinska
ed640630c1
svg_loader: mem properly freed
...
delete -> free
2021-11-12 10:46:53 +09:00
Mira Grudzinska
f3450e1760
svg_loader: memory properly released
...
delete->free
2021-11-11 21:49:13 +09:00
Hermet Park
c790e18de6
svg_loader: reduce binary size
...
saved 800 bytes.
2021-11-05 17:17:20 +09:00
Hermet Park
88d34f0d9a
svg_loader: reduce binary size
...
removed the std::string usages.
saved 17kb.
2021-11-05 17:12:53 +09:00
Mira Grudzinska
b85eaddcf2
svg_loader: passing the svgPath information into the _applyComposition
...
An image can be a mask, so the information about it's path is necessary
during a composition application.
2021-11-05 13:10:52 +09:00
Mira Grudzinska
0501863195
svg_loader: mask node loaded as a scene
...
Since the mask is a container element (in opposite to the clipPath),
it has to be loaded as a scene.
2021-11-05 13:10:52 +09:00
Mira Grudzinska
40f2baabae
svg_loader: SvgCompositeNode type introduced
...
Clips and masks require to implement some additional variables,
so the new node type has been introduced. Implementation of the usage
of these additional variables will be the subject of a separate
commit.
2021-11-05 13:10:14 +09:00
Mira Grudzinska
7176a5ddd4
svg_loader: define the scaling factors for units changing
...
The values in absolute units are calculated based on the pixel unit.
Till now the default value of 90dpi was used. Since CSS3 (now CSS4 is
the most recent) 1 inch equals to 96 pixels. The necessary constants
are introduces in this commit.
2021-11-02 11:29:41 +01:00
Mira Grudzinska
16a153c804
svg_loader: fix bounds for gradient
...
In the case when bounds should not include a stroke width, width
and height values were reduced by half of a stroke width, instead
of the full width.
2021-11-01 20:36:48 +01:00
Hermet Park
3b2e1f4291
Revert "loaders: Consider colorspaces ( #838 )"
...
This reverts commit cd5116b053
.
Ah this breaks the Stress example due to Picture::duplicate() is not available...
Need to consider and come back again.
2021-11-01 16:53:25 +09:00
Michal Maciola
cd5116b053
loaders: Consider colorspaces ( #838 )
...
* common: added colorSpace() function
This patch introduces colorSpace() function for SW and GL engine.
* infra: change LoadModule:read() into LoadModule:read(uint32_t colorspace)
This patch changes LoadModule:read() into LoadModule:read(uint32_t colorspace)
* picture: implement passing colorspace into loader
This patch implements passing colorspace into loaders.
Loader->read is now called on the first update.
* external_jpg_loader: support colorspaces
* external_png_loader: support colorspaces
2021-11-01 16:10:22 +09:00
Hermet Park
875e200767
common: code refactoring
...
removed invalid nullptr checks.
New allocation doesn't gurantee that returns nullptr when it's failed.
It's useless on the modern compliers and our policy respects it.
2021-11-01 12:09:32 +09:00
Michal Maciola
00dfd55f18
SVG: Support geometry properties of use tag
...
This patch adds a support for geometry properties (x, y) of <use> tag
2021-10-29 14:10:44 +09:00
Mira Grudzinska
4db3087c45
svg_loader: gradient transformation properly applied
...
The final gradient transformation depends on the coordinate system.
It can not be applied during an svg loading. The transformation matrix
has to be passed via api for further gradient processing.
2021-10-29 10:58:43 +09:00
Mira Grudzinska
ba25cb80eb
svg_loader: shape's bounds without a stroke
...
A shape's bounds used for a gradient transformation shouldn't take
a stroke into account.
2021-10-28 12:18:17 +02:00
JunsuChoi
664e95859c
svg_loader SvgLoader: Fix gradient default value
...
If isXXPercentage is true, then it is calculated accordingly.
2021-10-25 11:14:03 +02:00
Mira Grudzinska
5fc5fd7f2d
svg_loader: requested changes applied
2021-10-25 11:15:58 +09:00
Mira Grudzinska
60029327f0
svg_loader: gradient handling and recalculation changed
...
The need to convert the gradient values occurs only when they are given
as nominal values in the current user coordinate system (userSpaceOnUse).
2021-10-25 11:15:58 +09:00
Mira Grudzinska
a93b5b98a9
svg loader: converting the image path to the absolute one
...
The href image tag should point to an absolute image path.
2021-10-23 02:26:55 +02:00
Hermet Park
b0c964cbb4
svg_loader: code refactoring.
...
cast to proper value type.
2021-10-21 15:15:07 +09:00
JunsuChoi
1b675adca4
svg_loader XMLParser: Clean up parameter type
...
size_t to unsigned int
2021-10-21 15:03:47 +09:00
JunsuChoi
e5196d610d
svg_loader XMLParser: Refacotring simpleXmlParse method
...
1.
Remove macro function. The existing macro function
was doing meaningless nested `return false`.
2.
Extract the logic to find the type as a function.
3.
The SimpleXMLType::Error case is not actually used,
and in case of invalid XML, Do 'return false' immediately.
2021-10-21 15:03:47 +09:00
Hermet Park
9c8e785fdc
updated license
...
Add missing original copyright texts in the source code.
2021-10-20 22:50:07 +09:00
Michal Maciola
d7a3aa580a
svg_loader: fix potential mem corruption in _idFromUrl function
...
This patch fixes some potential memory corruptions in _idFromUrl function
when name (url) is longer than 50 chars or is incorrectly terminated.
2021-10-20 10:34:02 +09:00
Hermet Park
a3ecff9504
svg_loader util: fix the floating constant truncated to zero issue.
...
fyi, the minimum value of the float is 1.175494351 E-38
@Issue: https://github.com/Samsung/thorvg/issues/899
2021-10-15 15:20:01 +09:00
Mira Grudzinska
1abee9f8d5
svg_loader: fixing viewBox clipping
...
For vw=width and vh=height, vx or vy > 0 had no effect. Fixed
2021-10-15 12:33:26 +09:00
Michal Maciola
e186bb4a82
svg_loader util: fix missing quot
...
There was checking for 0 ('\0') that should be checking for '0'
2021-10-15 02:04:17 +09:00
Hermet Park
d9f421ff4a
svg_loader util: just fix a typo
...
exponet -> exponent
2021-10-13 20:12:51 +09:00
Hermet Park
5a6240bdf3
svg_loader util: code refactoring
...
fix for thorvg coding convention.
no logical changes.
2021-10-13 20:07:08 +09:00
Mira Grudzinska
0497ac894e
svg_loader: removed unused variable
...
The gradient values passed to the scene builder are always given as percentages,
so there is no need to mark/check that.
2021-10-13 18:40:05 +09:00
Mira Grudzinska
c2bbdccac1
svg_loader: removed unnecessary casting
...
The used scaling factor should be a float - casting it to an int caused
misevaluation of the radial gradient radius
2021-10-11 18:59:23 +09:00
projectitis
dad6c71b6c
all: fix warnings on MSVC
...
* Explicit casts to suppress warnings
* Fixed compiler warnings
2021-10-09 11:33:45 +09:00
Mira Grudzinska
a16e91b441
all: fix compiler warnings
...
pow->powf and sqrt->sqrtf
2021-10-07 14:49:00 +09:00
Mira Grudzinska
875e5bd058
svg_loader: proper handling width/height units ( #851 )
...
Units of the svg width and height tags were incorrectly assigned.
Percentage values will be handled separately.
2021-10-05 12:04:40 +02:00