Mira Grudzinska
828a15cfdb
svg_loader: class attribute added
...
It's the first step in introducing the css inline style sheets into tvg.
For now the class attribute is set only for SvgNodes (not for grads),
it's not used yet.
2022-02-08 17:58:53 +09:00
Michal Maciola
b033cfabbd
loader png external: fix potential memory leak if read fails
2022-02-07 23:53:51 +09:00
Mira Grudzinska
cc173c1fb2
common: styling++ (tabs -> spaces)
2022-02-01 13:58:41 +01:00
Hermet Park
9434923529
loader png: fix all memory leaks.
...
These were detected by asan with PicturePng example,
fixed them all.
2022-01-25 11:26:36 +09:00
Hermet Park
246149e91a
loaders jpg: fix all memory leaks.
...
These were detected by asan with PictureJpg example,
fixed them all.
2022-01-25 11:21:27 +09:00
Hermet Park
0f87685c85
svg_loader: ++robustness
...
Prevent recursive calls by counting just in case.
The size is arbitrary value, we can adjust it experimentally.
@Issue: https://github.com/Samsung/thorvg/issues/1161
2022-01-20 19:18:22 +09:00
Mira Grudzinska
922e3e10c0
svg_loader: group tags misinterpreted as parent nodes
...
Group tags in a format <tag .../> finds no application
to the rest of the svg file and should be skipped.
2022-01-19 16:42:06 +09:00
Rémi Verschelde
0c6c37b616
build: Add missing <cstring> includes for MinGW compatibility
2022-01-19 16:40:30 +09:00
Rémi Verschelde
4e14e30447
tvg_loader: Convert tvgJpgd.h EOL to LF
...
This makes it consistent with the rest of the codebase.
2022-01-19 16:35:38 +09:00
Mira Grudzinska
99da490ef7
svg_loader: memleak prevention
...
If image href set more than once, the memory was not freed.
2022-01-18 18:22:01 +01:00
Mira Grudzinska
ed3b17b228
svg_loader: preventing memcpy from a nullptr
...
In a case when a polygon/polyline had no points, there is nothing
to be copied.
2022-01-17 12:05:34 +09:00
Mira Grudzinska
04d3bb0ec0
svg_loader: fixing cyclic cloning of nodes
...
The reference node doesn't have to be placed inside the defs block,
so when refering to it, it is necessary to search the entire node tree.
In case of invalid svg file this can lead to circular references.
Added prevention against such a sutuation.
2022-01-17 12:03:57 +09:00
Mira Grudzinska
43e5644e8b
svg_loader: fixing memleak
...
Memory was not freed before reallocation (grad->ref can be overwritten
without freeing memory first) - fixed.
2022-01-15 17:26:20 +01:00
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
Hermet Park
36da47af80
png_loaders: fix the wrong premultiplying operations.
...
It should not modify the alpha channel value while premultiplying
that turned out with the wrong visual result.
@Issue: https://github.com/Samsung/thorvg/issues/655
2021-12-13 23:46:15 -08:00
Hermet Park
4cdf648e14
sw_engine image: support non-premultiplied alpha images.
...
Previously, translucent png images are not displayed properly
due to alpha channels premultiplication.
This patch implements that missing part to support it properly
by introducing the Surface data between canvas engine & rasterizer
@Issue: https://github.com/Samsung/thorvg/issues/655
2021-12-02 17:10:12 +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
JunsuChoi
baab43aff2
tvg_saver TvgBinInterpreter: prevent misaligned memory access
...
When parsing a binary stored as a char type,
interpreter can access the misaligned memory while accessing it with a pointer.
To prevent that, pass the array copied to memcpy as tvg Object.
2021-11-22 16:30:08 +09: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
56e2498466
png_loader: correct colorspace
...
decoding color channels rgba -> bgra
@Issue: https://github.com/Samsung/thorvg/issues/1007
2021-11-11 21:48:22 +09:00
Hermet Park
6ba2bc8eb3
tvg_loader: fix asan report.
...
revert c31c77c0fb
memory mis-alignment is detected by asan tool.
2021-11-09 17:11:10 +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
Hermet Park
0f2d7e3eef
jpg_loader: fix compiler warnings.
...
"warning: shifting a negative signed value is undefined [-Wshift-negative-value"
2021-11-02 19:49:57 +09:00
Hermet Park
c31c77c0fb
tvg_loader interpreter: tiny optmization
...
skip memory copy as possible.
2021-11-02 19:47:08 +09:00
Mira Grudzinska
6b132d77e8
tvg_saver/tvg_loader: gradient fill in the tvg format
...
Introducing the gradient transform() apis and changing the grad
algorithms made it possible to apply the shape's transformation
before saving the tvg file, in case the shape (or its stroke)
has a fill.
2021-11-02 19:37:02 +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
Hermet Park
3c7d037841
jpg_loader: code refactoring
...
removed unused variables.
2021-11-02 19:02:07 +09:00
Hermet Park
c8e7bc9d43
png_loader: code refactoring
...
removed unused variables.
2021-11-02 18:57:55 +09:00
JunsuChoi
590381f68b
infra meson: Add -Dstatic option
...
Add an option for use in environments where
the use of static libraries must be enforced.
2021-11-02 13:14:16 +09: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