Commit graph

1677 commits

Author SHA1 Message Date
Vincent Torri
e918a8cb5b fix compilation of svg2png on Windows 2022-08-23 22:41:28 +09:00
Hermet Park
ddb9bbdf0e common picture: code refactoring.
keep api parameter naming consistency.

ptsCnt, cmdCnt, triangleCnt ...
2022-08-20 15:21:31 +09:00
Hermet Park
240bf6259a common picture: code refactoring.
++ neat & clean
2022-08-20 14:44:20 +09:00
projectitis
510ffa571a Fix compiler warnings on windows 2022-08-20 12:30:35 +09:00
projectitis
3dd65dfed0 common picture: support image mesh feature
Tvg Picture newly provides mesh() api to support texture mapping.
These apis allows to have a coarse triangle list which have polygon coordinates
and texture uvs those are used for traditional polygon texture mapping.

Note that these apis are beta version.

@API Additions:

Result mesh(const Polygon* triangles, const uint32_t triangleCount) noexcept
uint32_t mesh(const Polygon** triangles) const noexcept

@Examples:

//Mapping with two polygons
Polygon polygon[2];

//First polygon
polygon[0].vertex[0].pt = {0, 0};
polygon[0].vertex[1].pt = {100, 0};
polygon[0].vertex[2].pt = {0, 100};
polygon[0].vertex[0].uv = {0, 0};
polygon[0].vertex[1].uv = {1, 0};
polygon[0].vertex[2].uv = {0, 1};

//Second polygon
polygon[1].vertex[0].pt = {100, 0};
polygon[1].vertex[1].pt = {100, 100};
polygon[1].vertex[2].pt = {0, 100};
polygon[1].vertex[0].uv = {1, 0};
polygon[1].vertex[1].uv = {1, 1};
polygon[1].vertex[2].uv = {0, 1};

//Apply polygons to the picture
picture->mesh(polygon, 2);

@Issues: https://github.com/Samsung/thorvg/issues/1218
2022-08-20 11:58:55 +09:00
JunsuChoi
638d69d635 sw_engine: Fix uninitialized variable
warning message
[35/42] Compiling C++ object src/libthorvg-0.dll.p/lib_sw_engine_tvgSwRaster.cpp.obj
In file included from ../src/lib/sw_engine/tvgSwRasterTexmap.h:96,
                 from ../src/lib/sw_engine/tvgSwRaster.cpp:83:
../src/lib/sw_engine/tvgSwRasterTexmapInternal.h: In function 'void _rasterPolygonImageSegment(SwSurface*, const SwImage*, const SwBBox*, int, int, uint32_t (*)(uint32_t), AASpans*)':
../src/lib/sw_engine/tvgSwRasterTexmapInternal.h:76:9: warning: 'maxx' may be used uninitialized [-Wmaybe-uninitialized]
   76 |         if (x2 > maxx) x2 = maxx;
      |         ^~
../src/lib/sw_engine/tvgSwRasterTexmapInternal.h:33:19: note: 'maxx' was declared here
   33 |     int32_t minx, maxx;
      |                   ^~~~
../src/lib/sw_engine/tvgSwRasterTexmapInternal.h:75:9: warning: 'minx' may be used uninitialized [-Wmaybe-uninitialized]
   75 |         if (x1 < minx) x1 = minx;
      |         ^~
../src/lib/sw_engine/tvgSwRasterTexmapInternal.h:33:13: note: 'minx' was declared here
   33 |     int32_t minx, maxx;
      |             ^~~~
2022-08-19 14:22:04 +09:00
Vincent Torri
de87cdc717 Windows: use _fullpath() instead of fullpath().
Fix compilation error
2022-08-17 19:44:05 +09:00
Hermet Park
714470e618 loaders raw: fix a compiler warnings on Windows.
fix the invalid conversion from float to uint32_t.

@Issue: https://github.com/Samsung/thorvg/issues/1229
2022-08-04 17:02:56 +09:00
Omar Polo
53074d250f fix OpenBSD compile issue
Linux seems the only system AFAICS to have alloca.h.  All the BSDs have
the declaration in stdlib.h
2022-07-13 10:28:46 +09:00
Rémi Verschelde
46c3fc1f94 Format code files with dos2unix, ensure newline at EOF 2022-07-10 23:21:05 +09:00
Rémi Verschelde
becb70f09d Cleanup FreeBSD preprocessor checks (if vs ifdef)
Should be equivalent but checking if the value is defined (`#ifdef`) is cleaner
than checking if it is set to something different from 0 (`#if`).
2022-05-24 10:32:53 +09:00
Martin Liska
0c987470af Fix building with GCC 13.
Fixes the following error:
../src/lib/tvgLzw.h:27:5: error: ‘uint8_t’ does not name a type
2022-05-23 22:39:24 +09:00
Hermet Park
0e8cd1e525 fix FreeBSD compile issue.
alloca is defined in stdlib.h on [freeBSD](https://www.freebsd.org/cgi/man.cgi?alloca)

additional fix to 75c1314ab0
2022-05-17 22:05:10 +09:00
Peter Vullings
47075bb3e6
Improve support for clang-cl on windows
* Better support for clang-cl on windows
* Fix runtime error caused by removing unwind tables
2022-05-14 00:17:30 +09:00
mundusnine
75c1314ab0 Fix on FreeBSD
Fix compile errors on FreeBSD.
- alloca is defined in stdlib.h on [freeBSD](https://www.freebsd.org/cgi/man.cgi?alloca)
Issue in [godot](https://cirrus-ci.com/task/5485473287110656?logs=build#L657)
2022-05-13 17:58:04 +09:00
JunsuChoi
8ef075eb27 svg2png: Add more error message types
Add a message according to the returned Result type.
2022-05-06 17:13:43 +09:00
JunsuChoi
0d010bdb6a svg_loader: Fix invaild '<' nested check
When Type is DOCTYPE, Child Entities start with '<'.
This condition is valid when general Elements (svg, g, path etc) are used.
Add a Doctype check to if condition.
(There can be various cases related to '<' nested case.
But for now, I only add Doctype considering the side effect.)
2022-05-05 11:36:16 +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
0925aa84a5 sw_engine: fixing oveflow
An overflow occurred for big shapes with a dashed stroke,
since a contour end points were stored as the uint16 type
(instead of the uint32 type).
2022-03-23 16:14:51 +09:00
mgrudzinska
1e8b8cbb53 svg_loader: symbol node without any viewbox/width/height info handled properly 2022-03-21 18:38:10 +09:00
Rémi Verschelde
bc5c29dd69 build: Add another <cstring> include for MinGW compatibility 2022-03-16 23:51:12 +09:00
Hermet Park
49c6336b33 examples - updated a resource usage 2022-03-08 18:39:32 +09:00
Hermet Park
6276175d5b prepare tvg v0.8 release
updated tvg binaries, back up them for backward compatibility test.
2022-03-08 18:25:48 +09:00
Mira Grudzinska
2ee25ea11d
svg_loader: width and height attribs of the use element applied 2022-03-07 11:32:02 +09:00
mgrudzinska
59399e8597 common: viewport values improperly rounded
For a very specific scaling factors shapes were to much clipped
because of wrong rounding of the viewport.
2022-03-07 11:30:20 +09:00
mgrudzinska
ed3608b39b svg_loader: use node fixed
By mistake the use node was improperly transformed and/or displayed
for a reference node other than a symbol node.
2022-03-02 17:18:13 -08:00
mgrudzinska
b16d60d509 svg_loader: symbol preserveAspectRatio attribute fixed
The symbol node was properly scaled only for 'preserveAspectRatio=none'.
Now it works also for the default value of this attribute (xMidYMid).
2022-03-02 17:18:01 -08:00
mgrudzinska
d1e7d60fc9 svg_loader: preserveAspectRatio fix
The default value should be xMidYMid, now it is.
2022-03-02 17:17:54 -08: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
c214532ad2 svg_loader: fixing symbol transformation
For a Symbol node, the transformation based on the 'viewBox', 'width'
and 'height' attributes has to be applied before the transformation
based on the 'transformation' attribute.
2022-02-21 11:21:22 +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
Hermet Park
ccce0d7641 jpeg_loader: resolve the asan bug report.
fix the invalid negative shift operations.

@Issue: https://github.com/Samsung/thorvg/issues/1172
2022-02-16 12:45:37 +09:00
Hermet Park
143cb83515 examples: adds a new sample svg 2022-02-14 14:38:39 +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
Mira Grudzinska
2fce4d46a0 svg_loader: the 'use' node properly transformed
The translation of the use node shouldn't overwrite its transformation.
2022-02-08 19:47:09 +09:00
Mira Grudzinska
d1fc538429 svg_loader: fixing the used mask-type
For the performance reasons, regardless of the set/default
mask-type value, if the mask is white, the alpha masking is
used. To qualify a mask as white, not only its fill has to be
checked, but its stroke as well. The second was missing.
2022-02-08 19:46:40 +09:00
Hermet Park
ff3ebd9abd svg_loader: code refactoring.
follow strict coding-style.

no logic changes.
2022-02-08 18:57:11 +09:00
Hermet Park
5f40449c3d example: just renamed the svg file. 2022-02-08 18:02:20 +09:00
Mira Grudzinska
0e4211fb96 example: cssStyle.svg add
For now it's a simple file used to check the styling precedence
and overall correctness.
After the css stylling will be fully introduced a more complex file
can be used,
2022-02-08 18:01:00 +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
Mira Grudzinska
ada4d5e261 svg_loader: a css style node shouldn't have a parent
This node is supposed to be separeted from the main tree nodes.
2022-02-08 17:58:53 +09:00
Mira Grudzinska
5aab26302a svg_loader: css style functions moved to a separate file 2022-02-08 17:58:53 +09:00
Mira Grudzinska
863a98870f svg_loader: styling++ (no logical changes) 2022-02-08 17:58:53 +09:00
Mira Grudzinska
4a7310756d svg_loader: fixing cdata block reading
The CData block is read if it's inside the style tag.
In a case when the CData block was just after the style
block, the data was still read, although it shouldn't be.
Fixed.
2022-02-08 17:58:53 +09:00
Mira Grudzinska
fbc596c09b svg_loader: tvg styling applied to the code 2022-02-08 17:58:53 +09:00