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.
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
Introduced the reference counting for the backend engines so that
tvg prevents unpaired engine initialization/termination calls by user mistake.
@Issues: 296
A duplicated picture needs to access internal picture loader data
to get its properties while rasterizing.
But it missed the loader since it's not copied from origin.
Thus, we fix this by sharing the internal loader among the duplications and origin.
@Examples: Duplicate
Description:
Fixed appendArc API for -90 angles. In that case it was drawn in wrong
direction.
@Examples
```cpp
float x = 40.0, y = 40.0;
auto shape1 = tvg::Shape::gen();
//OK
shape1->appendArc(x + 50, y, 25, 0, -91, false);
//NOK
shape1->appendArc(x + 100, y, 25, 0, -90, false);
//OK
shape1->appendArc(x + 150, y, 25, 0, -89, false);
```
If the boundary of scene created through the scenebuilder is larger than the viewbox,
scene(SVG's root) should be clipped to the size of the viewbox.
So, if scene need a clip, add a parent root and add clippath composition to that root.
This reverts commit 74b27c74af.
This patch breaks Stroke example. 1 line drawings...
There is a possibility that less 1 (i.e: 0.5) width axis-aligned line drawings...
So logically "&&" is correct.
The alpha value calculation pulled out outside the inner loop
to reduce the number of unnecessary operations.
Added local variables to reduce the number of costly
multiplications performed in a loop.
This condition(optimization) is not a step suggested by arc implementation.
https://www.w3.org/TR/SVG11/implnote.html#ArcCorrectionOutOfRangeRadii (Step2)
This code is useful if the arc is too small to represent.
However, scaling often occurs in vectors, which can create unnecessary problems.
example path
<path d="M32.41,20.49a.41.41,0,1,1-.41-.42A.41.41,0,0,1,32.41,20.49Z" transform="translate(0)" fill="#020202"/>