Commit graph

178 commits

Author SHA1 Message Date
Hermet Park
37a01b8735 portability: addressed all compilation warnings from MSVC 2023-12-26 18:05:36 +09:00
Hermet Park
97ac3194b4 sw_engine/raster: optimized the scaled image rasterization
Unified common logic for scaled image raster operations,
Avoid on-spot pixel computation as possible.

Tested on local machine (single thread)

Lottie: 0.057s -> 0.053s (-0.004s)
2023-12-26 17:51:23 +09:00
Hermet Park
9cbf300b8e sw_engine raster: fixed a default alpha blending bug.
alpha value has been missed by a mistake,
a regression by c50d2fd

Issue: https://github.com/thorvg/thorvg/issues/1716
2023-12-26 17:51:11 +09:00
Hermet Park
43f45ebd65 sw_engine/math: fine-tuning optimization
Try to minimize the use of sqrt() and arctan() calls
when possible. These calls can be relatively expensive
when accumulated within a single frame.

Also repalce the division with shift operation.
since split cubic function is one of the significant hot-spots
in the data processing, we could earn a noticable enhancement.

Tested on single thread local machine:

Lottie: 0.080 -> 0.052s (-0.028s)
Performance: 0.023 -> 0.022 (-0.001s)
Binary: +34
2023-12-26 17:51:04 +09:00
Hermet Park
81e3025ad9 sw_engine/math: Enhance trigonometric functions.
Streamlining computations with floating-point operations in rotation
thereby improving 'thorvg' speed.

Also use the well-optimized posix math functions instead of
custom math.

Test on my local machine.

Lottie: -0.008s (0.073 -> 0.065)
Performance: -0.0013s (0.0154 -> 0.0141)
Binary: -323
2023-12-26 17:50:43 +09:00
Hermet Park
0a9d98ccfd sw_engine/stroke: enhanced the quality of the dash line corners.
Previously, the engine didn't properly cover the dash line corner styles
because it considered a new line to start at the corner.

This update modifies the logic to recognize curved lines
as a single line, including the corners.

There may still be some quality issues,
but it's an improvement over the previous version.

@Issue: https://github.com/thorvg/thorvg/issues/121
2023-12-26 17:47:32 +09:00
Hermet Park
5ecd3fb479 sw_engine: Correct the color conversion condition.
The color conversion is supposed to take into account the differences between
straight alpha premultiplied color and pre-multiplied alpha color.

The previous logic does not perfectly cover these conditions.

The problem was occured in the thorvg viewer with a jpeg bgra format.
2023-09-26 18:57:34 +09:00
Hermet Park
51c3a8912c sw_engine: fix an invalid memory access.
the surface and mesh data can be missed by an invalid condition.
this fixes an invalid memory access problem.

Issue: https://github.com/thorvg/thorvg/issues/1671
2023-09-26 17:41:08 +09:00
Hermet Park
e4ade98e8c sw_engine: fix a regression stroke bug
reverted changes that occurred this issue from d683d2e

Issue: https://github.com/thorvg/thorvg/issues/1670
2023-09-26 14:26:57 +09:00
Hermet Park
9e3b74bac5 sw_engine fill: fixed radial fill focal issue.
This might be a workaround to correct the issue.
The threshold value comes from the mathematical inaccuracy.

@Issue:https://github.com/thorvg/thorvg/issues/1555
2023-09-21 22:19:42 +09:00
Hermet Park
edb156f4fc sw_engine/shape: fix a dash-line infite-loop bug.
a regresion bug was introduced by d683d2e70d
2023-09-21 21:55:53 +09:00
Hermet Park
bd9d0cea6d sw_engine: properly implemented the missing image composition.
The 8-bit masking target is the destination with a 32-bit source image and 8-bit composition.
2023-09-20 18:42:06 +09:00
Martin Capitanio
5ed7034c45 sw_engine: fix VS 2017 issues with Godot's NOMINMAX
Fixes #1661
2023-09-19 21:51:54 +09:00
Hermet Park
d683d2e70d sw_engine: Do not handle exceptions for zero line length.
While it may represent a dot with a stroke width,
ignoring its length is not a good idea.

this also eliminates 0 size dash dots caused by unexpected empty lengths.
2023-09-15 11:16:38 +09:00
Hermet Park
ed1b4a4923 sw_engine: allow 8bit grayscale gradient filling 2023-09-14 01:03:22 +09:00
Hermet Park
e9490e375c sw_engine: corrected a wrong blending equation at 8 bits grayscale rle. 2023-09-14 01:03:22 +09:00
Hermet Park
cea63125a4 sw_engine: fix a wrong compuation.
corrected a mistake caused by a dead brain.
2023-09-12 21:40:01 +09:00
Hermet Park
46d831ead7 sw_engine: skip the rendering if possible.
zero scale would not produce any visible artifacts.
we can skip the further processing sonner.
2023-09-12 20:52:33 +09:00
Hermet Park
2257211852 sw_engine: fix a regression bug by 0dafe9ff64
rectified the stroke scale factor acquisition.
2023-09-12 11:44:27 +09:00
Hermet Park
0dafe9ff64 sw_engine: revised code.
add a concrete logic for validating the stroke width
2023-09-05 18:41:20 +09:00
Hermet Park
78cb32794a sw_engine: utilize the memory pool for dash stroking. 2023-09-05 12:38:57 +09:00
Hermet Park
e0d1c947e6 infra: renamed the files for the consistency. 2023-09-04 17:26:43 +09:00
Mira Grudzinska
ce3c11838c renderer/sw_engine: support the focal property in the radial gradient.
@Issue: https://github.com/thorvg/thorvg/issues/1558
2023-09-04 16:48:38 +09:00
Hermet Park
ad9d9d0ecd loader/lottie: support trimpath feature 2023-09-01 13:16:18 +09:00
Hermet Park
735c1cb9e4 sw_engine: fixed a antialiasing issue.
Previously, a mechanism was introduced to skip antialiasing computations
when shapes are invisible due to their stroking. However, this mechanism
failed to account for the scale factor of the stroke; it only considered
the current stroke width as a threshold.

Consequently, when the stroke width is scaled up to a value smaller than
the threshold, the incorrect antialiasing approach is applied. This results
in the appearance of jagged edges.

The implemented fix rectifies this problem and ensures that the antialiasing
computation correctly takes into consideration both the visibility and the
scale factor of the stroke width.
2023-08-30 17:28:41 +09:00
Hermet Park
992891e6a8 sw_engine: a minor optimization.
reduced the point counting since we already know some of them.
2023-08-29 13:24:54 +09:00
Hermet Park
5a73bcaa8f common/array: code refactoring
easy access to a specific data with a operator.
2023-08-29 12:28:38 +09:00
Hermet Park
24711e485c infra: renames the source folders
lib -> renderer
bin -> tools
utils -> common
2023-08-28 13:11:24 +09:00