Commit graph

1669 commits

Author SHA1 Message Date
Hermet Park
192d29fa8a common array: enhance the features.
Add a push() method that appends a whole array instance.
2023-07-25 19:57:12 +09:00
Hermet Park
d53d8d726f common bezier: enhancement to the common Bezier function
Add a method that returns the angle at position 't'.
also revise bezAt() method to allow optimal usages.
2023-07-25 19:57:12 +09:00
Mira Grudzinska
20cf8c6725 sw_engine: fix compiler warning
Warning: comparison of integer expressions of different signedness

@Issue: https://github.com/thorvg/thorvg/issues/1526
2023-07-24 01:44:24 +02:00
Hermet Park
0e86cfebba sw_engine raster: ++strict types. 2023-07-19 21:57:04 +09:00
Hermet Park
d99d8a565f common array: fix a wrong size. 2023-07-18 15:09:21 +09:00
Hermet Park
463fc853be examples webp: --compiler warning.
1 warning generated.
[122/183] Compiling C++ object src/examples/PictureWebp.p/PictureWebp.cpp.o
../thorvg-git/src/examples/PictureWebp.cpp:38:18: warning: unqualified call to 'std::move' [-Wunqualified-std-cast-call]
    canvas->push(move(bg));
                 ^
                 std::
../thorvg-git/src/examples/PictureWebp.cpp:53:26: warning: unqualified call to 'std::move' [-Wunqualified-std-cast-call]
        if (canvas->push(move(picture)) != tvg::Result::Success) return;
                         ^
                         std::
../thorvg-git/src/examples/PictureWebp.cpp:77:18: warning: unqualified call to 'std::move' [-Wunqualified-std-cast-call]
    canvas->push(move(picture));
                 ^
                 std::
2023-07-18 11:02:26 +09:00
Hermet Park
952bc01c41 sw_engine: fix clang compiler warnings.
[29/73] Compiling C++ object src/libthorvg.a.p/lib_sw_engine_tvgSwStroke.cpp.obj
../src/lib/sw_engine/tvgSwStroke.cpp(258): warning C4244: 'argument': conversion from 'float' to 'int64_t', possible loss of data
[32/73] Compiling C++ object src/libthorvg.a.p/lib_sw_engine_tvgSwRaster.cpp.obj
../src/lib/sw_engine/tvgSwRaster.cpp(259): warning C4244: 'initializing': conversion from 'float' to 'uint32_t', possible loss of data
../src/lib/sw_engine/tvgSwRaster.cpp(260): warning C4244: 'initializing': conversion from 'float' to 'uint32_t', possible loss of data
2023-07-18 10:45:52 +09:00
Hermet Park
cf09ba5abd common sw_engine: code refactoring
Even though this enlarges the binary size by 300bytes,
use the array instead of individual implementations for better maintenance.
2023-07-17 20:14:58 +09:00
Hermet Park
5528eb9831 common array: code chores.
remove duplicated logic
this also changes the default grow size: N*2 -> N+(N/2)
2023-07-17 20:14:58 +09:00
Vincenzo Pupillo
c3af682f68 Refactoring of GlGeometry::decomposeOutline due to an internal change in RenderShape data structure. 2023-07-15 11:13:56 +09:00
Hermet Park
d7058e41e4 common bezier: fix a regression bug.
revert issued code from def6393d82.
2023-07-12 20:50:58 +09:00
Hermet Park
def6393d82 common bezier: Add a function that returns the position.
A utility for common use of the Bezier curve.
2023-07-11 18:35:33 +09:00
Hermet Park
46aa29781a common math: enhance matrix functions.
Accumulating matrix value factors would have broader usage.
2023-07-05 15:17:04 +09:00
Hermet Park
b81b23af62 common array: allow it to modify values. 2023-07-05 15:17:04 +09:00
Hermet Park
accb8c5699 svg loader: --compiler warnings
../src/loaders/svg/tvgSvgLoader.cpp: In function ‘void _copyAttr(SvgNode*, const SvgNode*)’:
../src/loaders/svg/tvgSvgLoader.cpp:2911:44: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
 2911 |             if (to->node.polygon.pts.count = from->node.polygon.pts.count) {
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/loaders/svg/tvgSvgLoader.cpp:2917:45: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
 2917 |             if (to->node.polyline.pts.count = from->node.polyline.pts.count) {
2023-07-04 01:17:25 +09:00
Hermet Park
d72d6aa51f loader svg: code cleanup
Use array instead of individual dynamic array implementation.
This also fixes wrong polygon & polyline data access during copy & paste...
2023-07-04 01:09:23 +09:00
Hermet Park
95ebbe4339 common array: + copy constructor
introduce the copy constructor to prevent duplicated code.
2023-07-04 01:09:23 +09:00
Hermet Park
b7dfe661b5 common: --unnecessary null check. 2023-07-03 15:49:16 +09:00
Hermet Park
1c824ed191 common: code refactoring
Replace individual array implementation with a common feature.
2023-07-03 14:20:05 +09:00
Vincenzo Pupillo
5f64baf642 Avx raster refactoring due to an internal change to support blending
methods.
2023-07-01 12:42:24 +09:00
Vincent Torri
dabd15c4c5 tvgArray: return a const reference for const methods 2023-06-30 17:18:04 +09:00
Hermet Park
b876427325 common array: revise the interface.
Implement a pair of access methods: last() and first().
2023-06-29 20:40:16 +09:00
Hermet Park
ec30301aec common shape: +tiny opimization.
don't update a frame, if the color is not changed.
2023-06-27 18:44:02 +09:00
Hermet Park
dce14a8449 common: promote MULTIPLY() to a common helper macro.
it's useful among the modules.
2023-06-27 18:44:02 +09:00
Hermet Park
4482664740 common array: ++enhance the usability.
+ end() which indicates the end of the data pointer.
2023-06-26 14:58:30 +09:00
Hermet Park
bd87f1398c common array: ++enhance the usability.
add last() which indicates the last element pointer.
2023-06-23 16:49:39 +09:00
Hermet Park
be1984982e example stack: updated sample.
use paints() method instead of grabbing a manual list.

@Issue: https://github.com/thorvg/thorvg/issues/1501
2023-06-20 15:48:02 +09:00
Hermet Park
caa214e4db sw_engine: code refactoring.
Renamed internal methods; the name 'RGBA' is sometimes confusing
because the channel composition does not accurately reflect it.

Therefore, it should be removed or replaced with 'Pixel'.
2023-06-20 14:57:01 +09:00
Hermet Park
00a87825b9 sw_engine: optimize code.
Considering the fundamental scenario,
the masking feature would likely be used less frequently.

We sacrifice a small amount of performance
by substituting the multiple implementations with blender calls.

However, this trade-off can result in a reduction in binary size.

Bin size: 212089 -> 205907 (-6kb)
2023-06-20 14:57:01 +09:00
Hermet Park
f36455048a examples: add SceneBlending 2023-06-20 11:30:18 +09:00
Hermet Park
0b65d1fce5 sw_engine raster: ++tiny optimization
Attempt to perform as much computation as possible
before entering the rasterization stage.

This contains the code refactoring as well.
2023-06-20 11:30:18 +09:00
Hermet Park
0cc7833000 example: update blending sample 2023-06-20 11:30:18 +09:00
Hermet Park
c50d2fde5f common sw_engine: support blending methods.
The blending feature allows user to combine colors to create visually appealing effects,
including transparency, lighting, shading, and color mixing, among others.

Its process involves the combination of colors or images from the source paint object
with the destination (the lower layer image) using blending operations.

The blending operation is determined by the chosen @p BlendMethod,
which specifies how the colors or images are combined.

@APIs:
 - enum class BlendMethod::Normal, Add, Screen, Multiply, Overlay, Lighten, Difference, Exclusion, SrcOver, Darken, Lighten, ColorDodge, ColorBurn
 - BlendMethod Paint::blend() const noexcept;
 - Result Paint::blend(BlendMethod method) const noexcept;

@Issue: https://github.com/thorvg/thorvg/issues/307

Co-authored-by: Peter Vullings <peter@projectitis.com>
Co-authored-by: Hermet Park <hermetpark@lottiefiles.com>
2023-06-20 11:30:18 +09:00
Hermet Park
eea54f5fea sw_engine: code chores & fix gradient filling bugs.
renaming internal methods for integrating with upcoming blending features.
this also fixes minor wrong gradient filling blending equations.
2023-06-20 11:30:18 +09:00
Hermet Park
b60a291edc sw_engine: code refactoring
Removed the fake blender structure.
Unified matting and join as Surface methods.
2023-06-20 11:30:18 +09:00
Hermet Park
814d87626c common engines: optimizing data packing for compactness.
Standardized the opacity data type to use 1 byte
across all instances to maintain consistency and reduce scattered usage.
2023-06-15 10:35:34 +09:00
Hermet Park
4f26a84b53 common: optimize paint data size.
packing the data fields with the appropriate size.

96 -> 24 (-9 bytes per one paint)
2023-06-14 10:46:30 +09:00
Hermet Park
075e3e6b2a tvg: support stroke miterlimit property.
implement the miterlimit property that was introduced by
44a750ee5d

@Issue: https://github.com/thorvg/thorvg/issues/1490
2023-06-14 10:46:12 +09:00
Hermet Park
8398fdbca7 tvg: recover the broken compatibility.
The issue was introduced by b214fd23bc
2023-06-13 12:23:17 +09:00
Hermet Park
4627daf6f7 api: enhance API usability
Set the default values of rx = 0 and ry = 0 for the shape.
Only the round rectangle shape requires the usage of these values.
2023-06-13 10:42:57 +09:00
Hermet Park
8305383989 sw_engine: optimize 64-bit rasterization.
Write the pixels per 64-bit data.
This optimization can potentially double the performance in the best case scenario.
It's visually noticeable, especially when the resolution is sufficiently large.

@Issue: https://github.com/thorvg/thorvg/issues/1471
2023-06-13 10:42:40 +09:00
Martin Capitanio
a597d3bb49 API, sw_engine: add stroke-miterlimit example. 2023-06-13 10:42:20 +09:00
Martin Capitanio
44a750ee5d API, CAPI, sw_engine: add suport for stroke-miterlimit. 2023-06-13 10:42:20 +09:00
Hermet Park
07dc68f655 capi: --redundant tag 2023-06-12 11:29:29 +09:00
JunsuChoi
595cc56e86 webp_loader: Introduce Webp image loader
Add external_webp loader which uses libwebp library.
2023-06-09 10:58:01 +09:00
Hermet Park
b214fd23bc common canvas/scene: introduce paints() api that returns the list of the paints.
These new apis would enable users to easily modify the motion scene,
The data structure of the paints has been changed from an array to a list.

@APIs:
std::list<Paint*>& Canvas::paints() noexcept;
std::list<Paint*>& Scene::paints() noexcept;

@Deprecated:
Result Canvas::reserve(uint32_t size) noexcept;
Result Scene::reserve(uint32_t size) noexcept;

@Issue: https://github.com/thorvg/thorvg/issues/1203
2023-06-09 10:54:03 +09:00
Hermet Park
6cbc1de570 api: enhance Shape::stroke() method usage.
Designate a default value for alpha which is mostly optional.
2023-06-07 12:10:31 +09:00
Hermet Park
1ae92daa9d api: enhance Shape::fill() method usage.
Designate a default value for alpha which is mostly optional.
2023-06-07 12:10:31 +09:00
Hermet Park
fbf8e8dfce Revert "api: remove deprecated apis"
This reverts commit aa000f7c56.

TVG will move forward to v0.10, so we still need to keep the deprecated APIs.
2023-06-07 10:49:20 +09:00
Hermet Park
dbdf103e82 sw_engine texmap: code clean up.
eliminate logic duplication by introducing a c++ template mechanism.

This will retain the opacity condition branches to minimize binary size.
2023-06-05 16:52:57 +09:00