Hermet Park
8c4b9b2772
renderer: code refactoring
...
Replaced the transformation with
a strong associated data field.
This helps to reduce the binary size (-1k).
2024-08-09 10:49:26 +09:00
Hermet Park
0c709b2e43
common: code refactoring
...
Trimming the transform data pass,
from RenderTransform to Matrix.
No logical changes.
2024-08-09 10:37:39 +09:00
Mira Grudzinska
273fe5b46d
sw_engine: fix radial coefficients calculations
...
In the Taylor series expansion, there was a missing
division by 2! in the term with the second derivative.
@Issue: https://github.com/thorvg/thorvg/issues/2530
2024-08-09 10:29:53 +09:00
Hermet Park
267a467dab
sw_engine: rectified the image raster return value.
...
Return the raster image as a success unless
it fails due to any problematic condition.
The changed cases are just invisible condition
of the images.
2024-07-26 12:13:37 +09:00
Hermet Park
57e0d5b448
renderer/animation: rectified the segment value exception
...
A zero-range segment can be useful for a stopped motion.
There is no need to prohibit these values.
2024-07-26 11:37:16 +09:00
Mira Grudzinska
641fe5b544
sw_engine: fix linear grad issue
...
The restriction of the 'length' of a linear gradient
to values greater than FLT_EPSILON was causing rendering
issues in cases where it was a valid gradient with well
defined dx and dy values.
@Issue: https://github.com/thorvg/thorvg/issues/2582
2024-07-26 11:37:16 +09:00
Hermet Park
4a447abaae
renderer: quick skip rendering if the opacity is zero
...
This also resolves a corner case bug introduced by
lottie render pooling: f06127ab93
2024-07-26 11:37:16 +09:00
Hermet Park
71a0010c2d
sw_engine: ++alpha blending operation.
...
Reduce instructions, improving its performance by ~15%
2024-07-19 08:42:19 +09:00
Mira Grudzinska
b876402311
common: version api introduced
...
@Issue: https://github.com/thorvg/thorvg/issues/2543
2024-07-19 08:42:02 +09:00
Hermet Park
183749d1aa
renderer: ++null check
...
fixed a Duplicate example crash, regression by:
f06127ab93
2024-07-19 08:41:54 +09:00
Hermet Park
cf253dd873
lottie: ++scene rendering optimization
...
Apply LottieRenderPooler to path/rect/ellipse/polystar.
This enhances the animation performance: ~10%
2024-07-19 08:41:38 +09:00
Mira Grudzinska
d0210a1a72
sw_engine: grayscale image support++
2024-07-19 08:40:06 +09:00
Hermet Park
318c76119a
common: replace the round() with nearbyint()
...
nearbyint() is 2x faster than round() in our local test.
2024-07-12 11:18:56 +09:00
Hermet Park
74f5928e84
sw_engine: ++rle optimization
...
Reduction memory copy by pushing span data into rle immediately.
2024-07-12 11:18:56 +09:00
Mira Grudzinska
8fceba01d2
sw_engine: fix masked translucent rect
2024-07-12 11:18:56 +09:00
Hermet Park
1c8698ce20
common/math: introduced custom atan2()
...
the custom atan2 algorithm by Remez.
see: https://en.wikipedia.org/wiki/Remez_algorithm
This improved the Lottie example by ~2ms.
Total atan2 performance time was reduced by 43%
2024-07-12 11:18:56 +09:00
Hermet Park
19815de7d7
renderer: ++optimization
...
skip locking if the thread number is 0.
2024-07-12 11:18:56 +09:00
RuiwenTang
90399665e2
gl_engine: fix aliasing in gradient rendering
2024-07-12 11:18:56 +09:00
RuiwenTang
b34fa36edb
gl_engine: make sure solid color not overwrite gradient fill
...
If there are both gradient colors and solid colors
the gradient color is used first for rendering
2024-07-12 11:18:53 +09:00
Hermet Park
42e008f69c
renderer: rectified render update flags.
...
Image update flag has been missed, when the image
is copied with a surface. This fixed it.
Also try to skip update if any properties were not changed.
2024-07-12 11:01:12 +09:00
Hermet Park
e12a244b9e
renderer: Rectified the paint transforms.
...
This corrects the return value to Result::InsufficientCondition
when a custom transform is applied.
Additionally, unnecessary x and y member fields have been removed.
2024-07-12 11:01:01 +09:00
Hermet Park
f080976101
gl_engine: --deprecated warnings on macOS
...
macOS has officially deprecated OpenGL.
shutdown the warnings to avoid be side-tracked.
2024-07-05 12:19:34 +09:00
RuiwenTang
619a352cb2
gl_engine: fix memory leak when rendering image
2024-07-05 12:19:34 +09:00
Hermet Park
a3c5b0ec2f
gl_engine: ++thread safety
...
The `dispose()` method can be called on a worker thread.
GL resources are released on `sync()`, ensuring guaranteed thread safety.
2024-07-05 11:04:28 +09:00
RuiwenTang
45c0e532fb
gl_engine: support simple hairline stroke rendering
...
Reduce alpha if stroke width is too thin to mock hairline rendering
2024-07-05 11:02:44 +09:00
RuiwenTang
bfc09be82a
gl_engine: optimize off-screen rendering
...
Performing a full-screen RenderPass resolve is too expensive.
Because most composite cases only require a small area to be rendered off-screen.
To improve performance, use the bounds of the Geometry for off-screen rendering whenever possible
2024-07-05 11:02:32 +09:00
Hermet Park
a328343dc7
common: Fix a compilation failure on VS 2017
...
issue: https://github.com/thorvg/thorvg/issues/2512
2024-07-05 10:58:04 +09:00
Hermet Park
6071d3f933
sw_engine: support the grayscale scaled-image drawing
2024-07-05 10:56:02 +09:00
Mira Grudzinska
b1618fe92a
sw_engine: fix aa
...
For shapes with a stroke that has opacity, anti-aliasing
should be applied to a fill.
The use of a transparent gradient stroke will also be handled
correctly.
2024-07-05 10:55:37 +09:00
Hermet Park
7299295f05
api: ++description
...
issue: https://github.com/thorvg/thorvg/issues/2494
2024-07-05 10:55:26 +09:00
Mira Grudzinska
172429ea7c
sw_engine: improve grad quality
...
For gradients with fill spread set as repeat,
the lack of anti-aliasing between the last and
the first color caused noticeable jagged edges.
Interpolation was introduced between them,
visually improving the gradient quality.
2024-07-05 10:54:29 +09:00
Thaddeus Crews
97aa39d7cf
common: ensure const equality operators
...
A minor syntactic adjustment to two instances of operator== and one instance of operator!=, both to the end of ensuring these locally-scoped functions are properly identified as const. In the majority of cases, this shouldn't have any impact; however, this change makes these operators play nice in c++20 contexts.
2024-07-05 10:54:12 +09:00
Hermet Park
5f4468236c
sw_engine: ++thread safety
...
Synchronize the engine process precisely
before updating internal data.
2024-06-27 14:42:27 +09:00
Mira Grudzinska
66048b31b5
wg_engine: fix shapes closing
...
Shapes were incorrectly closed in certain cases -
the decision to close a shape or not should be based on
path commands rather than the number of points and
their distances from each other.
2024-06-27 14:42:27 +09:00
Hermet Park
38e2812004
renderer: ++stabilization
...
This introduces a managed condition to precisely control the
canvas updates. This prevents a crash when the target is
changed and drawn without any update calls.
issue: https://github.com/thorvg/thorvg/issues/2484
2024-06-27 14:42:27 +09:00
Mira Grudzinska
0f2fe0c4d4
common: fix rendering failure
...
In case of a problem with loading font data, there
is no paint inside a text that can be rendered,
but this should not interrupt the rendering process
of other paints. Now fixed.
@Issue: https://github.com/thorvg/thorvg/issues/2468
2024-06-27 14:42:27 +09:00
Hermet Park
dcf67e9c14
Revert "renderer/canvas: Check refresh before draw"
...
This reverts commit 60212747b5
.
this triggered duplicated updates,
it came up with many thread sanitizer problems.
issue: https://github.com/thorvg/thorvg/issues/2462
2024-06-27 14:42:27 +09:00
Sergii Liebodkin
119ca34219
wg_engine: force texture data writing on GPU side
...
Texture must be fully uploaded into GPU memory before we can use or destroy it.
This change force texture data updates
2024-06-27 14:42:27 +09:00
Sergii Liebodkin
58705281cd
wg_engine: fix stroke mitter limit
...
Change the appliense of stroke mitter limit as in SVG spec
Before/After
2024-06-27 14:42:27 +09:00
RuiwenTang
2c84033a07
gl_engine: correct the return value of render function
...
If RenderData has nothing to draw, need to return `true`.
2024-06-27 14:42:27 +09:00
RuiwenTang
95dde5807e
gl_engine: Fix memory leak caused by no deleted GlRenderTask
2024-06-27 14:42:27 +09:00
RuiwenTang
667b259b89
gl_engine: Fix compose render not correct after canvas resize
...
When canvas size changed, need to clear cached GLRenderTarget and
GLCompose.
2024-06-27 14:42:27 +09:00
Hermet Park
518be23db2
gl_engine: revise the gl portability
...
- guarantee minimum gl version requirement
- removed glesv2 dependency
- corrected gl ver dependency
issue: https://github.com/thorvg/thorvg/issues/2282
2024-06-27 14:42:27 +09:00
Hermet Park
4b01c0ef52
renderer/canvas: ++exceptional handling.
...
do not allow change the target if the condition is not satisfied.
2024-06-27 14:42:27 +09:00
JunsuChoi
35b1d9a544
renderer/canvas: Check refresh before draw
...
If target() is called again after update() is called and the size of the buffer changes, a crash may occur.
Therefore, check the refresh variable and perform drawing after update().
2024-06-27 14:42:27 +09:00
RuiwenTang
5836661155
gl_engine: Fix compile error if only has OpenGL library on MacOS
...
Since GLES headers and library can not be found on MacOS,
use macros to determin if link with OpenGL library.
2024-06-27 14:42:27 +09:00
Hermet Park
2fb79eca7d
sw_engine: fix missing fill/stroke raster
...
properly update the fill/stroke when the path
has been changed
2024-06-27 14:42:27 +09:00
Hermet Park
d5c38cebb7
renderer: minor optimization
...
reduce the path flag writing
2024-06-27 14:42:27 +09:00
Mira Grudzinska
58e24f63a4
sw_engine: fix stroke miterlimit precision
...
Since the value was casted to int the results
were different than expected.
2024-06-27 14:42:27 +09:00
Hermet Park
ef409139c2
infra: promote the GL engine to an official one.
...
The ThorVG OpenGL/ES engine has been stabilized and improved
significantly. Now, as a graphics engine, its drawing features
are quite functional. It is time to officially release the
engine and maintain it in the release process.
Thanks @Ruiwen for going above and beyond!
issue: https://github.com/thorvg/thorvg/issues/2435
2024-06-27 14:42:27 +09:00