Commit graph

676 commits

Author SHA1 Message Date
Mira Grudzinska
332012dd6b loader svg: displaying SVG images without the specified viewBox attribute
If no viewBox attribute is given, the height and width attributes are used
to establish the viewBox size. However, this information was not available
inside the scene builder, even though it was needed.
2021-04-15 04:34:44 -07:00
Hermet Park
f1feebf047 common: code refactoring.
renamed internal function, no logical changes.
2021-04-15 18:26:11 +09:00
Mira Grudzinska
a13561e9c5 sw_engine: adding a check before stroke fill dereference
The crash was observed for empty shapes.
2021-04-15 13:33:58 +09:00
Hermet Park
6276e209a7 common initializer: counting engine init count properly.
Manage the reference count in common so that
all common resources can be initialized/terminated identically.
2021-04-14 20:18:06 +09:00
Mira Grudzinska
0f9d3ff6e9 examples: ignoring pictures other than svgs in Stress.cpp
The picture->size() function does not work for raw/png pictures.
As a consequence enabling both, the svg and png file loaders,
resulted in the unintended behavior of the example.
2021-04-14 17:17:10 +09:00
JunsuChoi
5d81fe2446 loader SvgLoader: Fix for coding convention 2021-04-13 19:01:19 +09:00
JunsuChoi
b75e7ea91a loader SvgLoader: return null if transform attribute invalid
In transform matrix parsing, null is returned if any of the matrices are invalid.
2021-04-13 19:01:19 +09:00
Hermet Park
d3a73f7ee9 loaders svg: fix a wrongly handles the corner case.
Stop the internel loop quick as possible, and state must be reset.
2021-04-13 17:49:29 +09:00
Hermet Park
b3559ecf56 loaders svg: code refactoring.
keep it clean & neat within tvg coding convention.
2021-04-13 17:16:38 +09:00
Hermet Park
d2c04f6037 wasm: fix compile errors. 2021-04-09 22:18:57 +09:00
Hermet Park
352f843d2b sync versioning 0.1.0 2021-04-09 21:42:28 +09:00
Hermet Park
5c9016158e loader svg: fix composition(mask/clip) issue.
composition target missed transform of its source.

That brings incorrect composition area.

This fixes it.
2021-04-09 21:02:55 +09:00
Mira Grudzinska
30ee03002b sw_engine: fixing stroke gradient
Instead of checking the stroke's fill, the shape's fill was checked.
As a result the improper rastering function was called (or none).
2021-04-09 13:18:52 +02:00
Hermet Park
35fdc9a278 loaders svg: set default color for composition paint.
not only clippath but alpha compositions might also have any valid color.
Set it default and let it override values while appending shapes if it's necessary.
2021-04-09 17:10:20 +09:00
Hermet Park
903df3da6a loaders svg: prevent composition setting if the result shape is invalid.
Current loader could return invalid shapes -default, from _appendShape()-
by a certain interpretation result,

Though it's a wrong or exception case, we can prevent worse case by avoiding it.
2021-04-09 16:51:05 +09:00
Hermet Park
e1eb98af79 loaders svg: code refactoring
clean up code and remove unnecessary internal class.

this also helps to reduce binary size by 5.5kb

no logical changes.
2021-04-09 15:57:23 +09:00
Hermet Park
adf1312a5e loaders svg: ++ log info for wrong situation.
if either log is printed, we need to improve the composition method.
2021-04-09 11:02:35 +09:00
Hermet Park
605a3bf175 loaders svg: code refactoring
++ clean code.
2021-04-09 10:55:09 +09:00
Hermet Park
6239eca92f loaders svg: fix invalid clip path result.
tvg engine expects the valid clippath with valid colors,
loaders set any colors values to enable it.

this fixes invalid clippath behavior.
2021-04-08 17:54:25 +09:00
Hermet Park
818d24fc70 sw_engine: fix GradientStroke crash
++ strict null check.
2021-04-08 14:15:23 +09:00
Mira Grudzinska
fcad63ec1f sw_engine raster: adding antialiasing to the gradient rastering functions
The gradient rastering functions with composition did not take
antialiasing into account. The missing part has been added.
2021-04-08 13:54:38 +09:00
Mira Grudzinska
9d7a264610 sw_engine raster: refactoring the gradient rastering functions
The gradient rastering functions have been splitted into translucent
and opaque.
2021-04-08 13:54:38 +09:00
Mira Grudzinska
6b5db72f67 sw_engine: rastering the opaque radial gradient with masking
In the radial gradient rastering functions, the part supporting
the (inverse) masking was added.
2021-04-08 13:54:38 +09:00
Mira Grudzinska
8284b3fdfc sw_engine: removed unnecessary function parameter
In the fillFetchLinear function the offset parameter was removed.
The destination address may be shifted directly in the dst parameter,
it doesn't need to be passed separately.
2021-04-08 13:54:38 +09:00
Hermet Park
4557ed6c4b binary optimization
remove inlining to reduce size by 22kb.
2021-04-07 21:27:21 +09:00
Hermet Park
6388a6a9dd common paint: fix wrong fast clippath logic.
it missed to check clippath's transform in fasttrack logic.
now it additionally check it...
2021-04-06 22:28:38 +09:00
Hermet Park
34bce8d371
Update README.md 2021-04-05 22:33:05 +09:00
Hermet Park
9a40b64261 sw_engine raster: ++ precise alpha multiplying
previously alpha multiplying operation doesn't have perfect precision,
could loss 1 pixel since it divides 255 values by 256.

This improved operation comply with both precision & performance.
2021-04-05 12:04:25 +02:00
Hermet Park
9a1d7ec841
Update CONTRIBUTING.md 2021-04-02 13:30:53 +09:00
Hermet Park
cd0c7486f3 loader png: code refactoring
Seperate behaviors open/read/close,
free/close pngimage properly,
add copyright for files.

There still left one optimization point by applying Task.
2021-04-02 12:50:38 +09:00
Hermet Park
9e725226da
meson: revise png loader meson script.
We hate spagettie code, not even build script.
this revise it to keep the build script consistency.
2021-04-02 12:49:18 +09:00
Mira Grudzinska
44f10698ed sw_engine: unnecessary memory allocation and variables has been removed 2021-04-01 21:19:14 +09:00
Hermet Park
fdd14a51a7 loader loaderMgr: add a useful debug message.
Print info if file format is not supported.
2021-04-01 21:12:49 +09:00
Hermet Park
6cc7dfdc56 examples: revise picture sample code. 2021-04-01 20:05:07 +09:00
Mateusz Palkowski
ac3e848cfe minor fixes 2021-04-01 19:38:30 +09:00
Mateusz Palkowski
1046ed2c40 Added png loading example 2021-04-01 19:38:30 +09:00
Mateusz Palkowski
832568e07a Added libpng based png loading 2021-04-01 19:38:00 +09:00
Mira Grudzinska
fe32ca8de7 sw_engine: fixing linear gradient rastering for shapes with composition
Masking and Inverse masking are for now rastered properly only for the linear
gradients without the opacity.
2021-04-01 11:51:08 +09:00
Patryk Kaczmarek
cd6fb4f483 gradients: paint linerar gradients properly with mask composition method
@Issues: 243

Change-Id: Ie26a0b903af94a46683348e3fb7d8b554576997c
2021-03-31 20:38:16 +09:00
Mira Grudzinska
f62ee4fc84 capi: changing function name
For uniformity of the functions naming the function name
tvg_shape_stroke_get_gradient changed to tvg_shape_get_stroke_gradient.
2021-03-31 16:42:29 +09:00
Hermet Park
c7f09bb333 doc: update sample images. 2021-03-26 19:38:34 +09:00
Hermet Park
bf6c0770dc
Update README.md 2021-03-26 19:35:26 +09:00
Hermet Park
4a19e5b9f6 common: fix wrong viewport region.
in the clip rect, viewport must be accumulated to the smaller one.
this patch improves that corner-case.
2021-03-26 17:24:43 +09:00
Hermet Park
f1fe36d8f6 common sw_engine: optimize single rectangle ClipPath.
If ClipPath is a singular rectangle,
we don't need to apply this to all children nodes to adjust rle span regions.

Rather than its regular sequence,
we can adjust render region as merging viewport that is introduced internally,

All in all,
If a Paint has a single ClipPath that is Rectangle,
it sets viewport with Rectangle area that viewport is applied to
raster engine to cut off the rendering boundary.

In the normal case it brings trivial effects.
but when use SVGs which has a viewbox, it could increase the performance
up to 10% (profiled with 200 svgs rendering at the same time)

Note that, this won't be applied if the Paint has affine or rotation transform.

@Issues: 294
2021-03-26 17:10:35 +09:00
Hermet Park
4a8f45577a
sw_engine: code refactoring
1. unified clip & bounding box in rle processing
2. unified outline boundingbox functions between shape & image.
2021-03-24 18:48:39 +09:00
Hermet Park
19fc4f4b37 examples: allow a desianted main thread capacity.
Maximum threads is not always peak the highest performance,
tvg examples guide user the proper threads count.
2021-03-24 14:19:01 +09:00
Hermet Park
aa68481fb7 common paint: fix memory leak case.
free the previous composition target if any,
before reset with the new one.
2021-03-23 16:35:22 +09:00
Hermet Park
1a7d41ce71 updated copyright 2021-03-23 14:31:58 +09:00
Hermet Park
e5381da223
common engines: code refactoring
Introduce RenderRegion structure for region data
to simplify the methods paratemers.

also depends on the NRVO for the return data.
2021-03-23 14:18:17 +09:00
Mira Grudzinska
234a9b2f93
svg_loader: ommiting xml entities in the svg file (#278)
SVG files created using 'sketch' may contain xml entities,
which are not understandable by the svg loader.
For now only '"' is ommited.
2021-03-23 09:22:46 +09:00