Commit graph

1443 commits

Author SHA1 Message Date
Martin Capitanio
6f715b46a7 Fix clang compiler warnings.
[clang] Warn on unqualified calls to std::move and std::forward
See: https://reviews.llvm.org/D119670
2023-05-20 20:10:56 +09:00
Mira Grudzinska
2309a48369 capi: tvg_shape_set_paint_order introduced
Capi sets the rendering order of the stroke and the fill.
2023-05-20 13:23:47 +09:00
Hermet Park
5ceeb32ef0 api: remove a beta api.
- Result Picture::viewbox(float* x, float* y, float* w, float* h) const;  //c++
- vg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x, float* y, float* w, float* h);  //c

@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-05-20 13:22:52 +09:00
Hermet Park
fe14e4f499 api: rename beta apis.
- SwCanvas::Colorspace::ABGR8888_STRAIGHT -> SwCanvas::Colorspace::ABGR8888S
- SwCanvas::Colorspace::ARGB8888_STRAIGHT -> SwCanvas::Colorspace::ARGB8888S

@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-05-20 13:22:52 +09:00
Martin Capitanio
baf21761f7 infa: Install svg2png and svg2tvg.
Meson can install stripped versions to
the standards-compliant (or --prefix) location.
2023-05-19 18:15:06 +09:00
Hermet Park
0e960e2d2b sw_engine: remove an unused function. 2023-05-19 10:56:59 +09:00
Hermet Park
f2fdc380b4 fix compiler warnings on MacOS
warning: unqualified call to 'std::move' [-Wunqualified-std-cast-call]
2023-05-19 10:56:59 +09:00
Hermet Park
89db13037d common sw_engine: gather scattered stroking composition.
There are two branches for completing stroke composition between the canvas and sw_engine.

It is necessary to centralize the task on the canvas engine side so that
we can maintain the logic without confusion.
2023-05-19 10:35:24 +09:00
Hermet Park
3626ded041 examples svg: adjust window size.
Still some display size is not enough large.
2023-05-19 10:35:24 +09:00
Hermet Park
d55ba07646 examples masking: updated for stroking composition. 2023-05-19 10:35:24 +09:00
Hermet Park
6994925b9d common shape: fixing stroking composition issue.
When combining Shape, Stroke, and AlphaMasking, there is a missing
composition step which results in an incorrect output as expected by the user.

This problem is resolved by introducing shape fill and stroking composition.

@Issue: https://github.com/thorvg/thorvg/issues/209
2023-05-19 10:35:24 +09:00
Hermet Park
42e0f8c3a3 infra: enable strip flag only when it's requeted.
$meson . build -Dstrip=false  //off
$meson . build -Dstrip=true   //on
2023-05-17 22:17:10 +09:00
Hermet Park
d8687314a6 common picture: fix a composition bug.
Previously, a picture with a half-translucent mask would not function correctly.
This fix addresses the bug by applying the expected composition step.

Note: Even after applying this patch, a half-translucent mask with shape fill alpha will still not work properly.
We should consider removing the fill alpha property, as it duplicates the Paint opacity.

@Issue: https://github.com/thorvg/thorvg/issues/1423
2023-05-17 11:11:55 +09:00
Hermet Park
c7d77b3517 common scene: fix a potential composition bug.
In the current implementation, only a scene with a single shape type
is able to skip the composition step. However, a child picture might
have multiple children shapes as well, which leads to the bug.
2023-05-17 11:11:55 +09:00
Vincent Torri
be2de28312 portability: fix usage of TVG_API
Rule of thumb on Windows:
  * for a DLL:
    * if the library is built, set TVG_API to __declspec(dllexport)
    * if the library is used, set TVG_API to __declspec(dllimport)
  * for a static library, set TVG_API to nothing

To set TVG_API for a static library, TVG_STATIC is defined when the stataic library is built.
Otherwise, TVG_API is correctly set for a DLL.
Also sun and intel compilers are handled

@issue: https://github.com/thorvg/thorvg/issues/1446
2023-05-16 18:55:33 +09:00
Hermet Park
41c41b538d examples: updated SVG samples.
increase the canvas to afford more resources.
2023-05-16 11:46:28 +09:00
Mira Grudzinska
2cfa5505c3 svg_loader: fixing finding defs node
In the case when a 'use' node was used
in a 'defs' block  and the element it
referenced was also defined within the same
'defs' block, the reference node could not
be cloned. This was because the 'defs' node
could not be located.

@Issue: https://github.com/thorvg/thorvg/issues/1451
2023-05-16 10:43:45 +09:00
Mira Grudzinska
40ef9031ba svg_loader: copy the use node properties
A bug was observed when a 'use' node was
referenced in another 'use' node.

@Issue: https://github.com/thorvg/thorvg/issues/1451
2023-05-16 10:42:35 +09:00
Hermet Park
9d9f38c875 common: code refactoring
Replace standard casting with tvg::cast()
2023-05-15 12:07:55 +09:00
Hermet Park
aa000f7c56 api: remove deprecated apis
- Result Paint::bounds(float* x, float* y, float* w, float* h) const noexcept;
- Result Picture::load(const char* data, uint32_t size, bool copy = false) noexcept;

@Issue: https://github.com/thorvg/thorvg/issues/1372
2023-05-13 18:30:11 +09:00
Hermet Park
f95c91ddc2 engine gl: fix build error 2023-05-12 12:06:00 +09:00
Hermet Park
0dec5a44b6 engine gl: specify gl as beta
The engine hasn't been maintained propelry and it's not functional.
2023-05-12 12:06:00 +09:00
JunsuChoi
597b88b118
jpg_loader: Add file existence check
Prevent memory leaks.

==2277==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f71c4ff2587 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cc:104
    #1 0x7f71c4a8d56a in jpgdHeader(char const*, int*, int*) ../src/loaders/jpg/tvgJpgd.cpp:2930
    #2 0x7f71c4ad4f85 in JpgLoader::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ../src/loaders/jpg/tvgJpgLoader.cpp:59
    #3 0x7f71c497d663 in LoaderMgr::loader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool*) ../src/lib/tvgLoader.cpp:174
    #4 0x7f71c4992d81 in tvg::Picture::Impl::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ../src/lib/tvgPictureImpl.h:220
    #5 0x7f71c498aa86 in tvg::Picture::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ../src/lib/tvgPicture.cpp:58
    #6 0x55df238cb293 in C_A_T_C_H_T_E_S_T_24 ../test/testPicture.cpp:371
    #7 0x55df2366d499 in Catch::RunContext::invokeActiveTestCase() ../test/catch.hpp:13025
    #8 0x55df236dee1b in Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) ../test/catch.hpp:12998
    #9 0x55df23710586 in Catch::RunContext::runTest(Catch::TestCase const&) ../test/catch.hpp:12759
    #10 0x55df237252d4 in execute ../test/catch.hpp:13352
    #11 0x55df237252d4 in Catch::Session::runInternal() ../test/catch.hpp:13562
    #12 0x55df23726b86 in Catch::Session::run() ../test/catch.hpp:13518
    #13 0x55df235f7179 in int Catch::Session::run<char>(int, char const* const*) ../test/catch.hpp:13236
    #14 0x55df235f7179 in main ../test/catch.hpp:17543
    #15 0x7f71c3791082 in __libc_start_main ../csu/libc-start.c:308

SUMMARY: AddressSanitizer: 24 byte(s) leaked in 1 allocation(s).
2023-05-11 23:44:46 +09:00
Hermet Park
4513bc1c4d examples tvg: updated samples
TvgSaver has been updated by 77114a8ac8
2023-05-11 02:01:40 +09:00
Mira Grudzinska
77114a8ac8 tvg_saver: fixing unwanted merging
Similar shapes are merged to improve
performance. This should not be the case
with a semi-transparent fill, different
shapes' fill-rule or fill-rule set to evenodd.

@Issue: https://github.com/thorvg/thorvg/issues/1440
2023-05-11 01:57:19 +09:00
Hermet Park
54ef8a5e50 infra: updated tvg resources 2023-05-10 14:35:42 +09:00
Hermet Park
7956a21fc2 sw_engine: fix the dead lock issue.
fully recovered from the scene clipping multi-tasksing.

@Issue: https://github.com/thorvg/thorvg/issues/1430
2023-05-09 15:56:30 +09:00
Mira Grudzinska
ac86c522f1 capi: luma mask introduced, tvg_picture_load_raw description changed 2023-05-09 15:55:22 +09:00
Mira Grudzinska
52260067e4 common: changed a returned value from load function
In the event that malloc returns a nullptr while copying
loaded raw data, a Result::NonSupport value is returned.
However, it appears that Result::FailedAllocation would be
more accurate.
2023-05-09 15:54:20 +09:00
Mira Grudzinska
cfead5ff68 sw_renderer: fixing names after refactor
the 'buffer' doesn't exist any more in the Surface
struct. Replaced by tjhe 'buf32' - error visible
only while avx and neon rendering supported.
2023-05-08 22:04:01 +09:00
Hermet Park
3376f44de5 sw_engine: ++8bit grayscale rasterizer.
These rasterizers are added for 8bit maskings.
2023-05-08 10:55:03 +09:00
Hermet Park
737b89471a examples: ++performance test
Add masking to figure out the perf result.
2023-05-08 10:55:03 +09:00
Hermet Park
4893746eb2 sw_engine: code refactoring
use shorter name.
2023-05-08 10:55:03 +09:00
Hermet Park
da6216f9bf sw_engine: specify buffer size so that we can clearly access the buffer data.
Also, it introduces the 'pixel_t' type to ensure that anonymous pixel data
follows the system's decision.
2023-05-08 10:55:03 +09:00
Hermet Park
f18d2557e3 sw_engine raster: code refactoring.
Move partial region in rasterClear()
2023-05-08 10:55:03 +09:00
Hermet Park
0ce2208be0 examples masking: added nested masking scenario. 2023-05-08 10:55:03 +09:00
Hermet Park
527b1af926 common sw_engine: applied colorspace format size.
Now backend engines know which channel size is required for
compositions.

@Issue: https://github.com/thorvg/thorvg/issues/976
2023-05-08 10:55:03 +09:00
Hermet Park
e3f363fea7 common render: added a new type for one byte pixel data.
This is designed using for masking buffers.

@Issue: https://github.com/thorvg/thorvg/issues/976
2023-05-08 10:55:03 +09:00
Hermet Park
01b26c43a6 engine: add Renderer::colorSpace() interface
This is necessary for acquiring current format size.

@Issue: https://github.com/thorvg/thorvg/issues/976
2023-05-08 10:55:03 +09:00
Hermet Park
1302c18f28 common sw_engine: polished code
--OOM handling
++exception handling
++log info
2023-05-08 10:55:03 +09:00
Hermet Park
3c8a4afaa7 sw_engine: fix the broken scene clipping.
The implementation has been reverted by https://github.com/thorvg/thorvg/issues/1409

Since the sanitizer is not matured fully and it's false positive as far as I figured,
We revert the scene clipping part.

@Issue: https://github.com/thorvg/thorvg/issues/524
2023-05-06 19:22:21 +09:00
Hermet Park
d7eb913741 sw_engine: fix a logical wrong.
the value should be updated properly.
2023-05-06 15:14:11 +09:00
Hermet Park
cc1f86e719 canvas: ++ log msg for dev 2023-05-05 15:52:41 +09:00
Mira Grudzinska
2a0a3950e6 svg2png: rounding up svg width and height
The svg width/height values were cast to int,
which could result in cutting off a small part
of the image. Now, in the case of a non-integer
size, it will be rounded up.

@Issue: https://github.com/thorvg/thorvg/issues/1414
2023-05-05 10:58:54 +09:00
Hermet Park
e8eef1af1d common taskscheduler: revert 4db25db962
There is a report of the thread sanitizer.
It could be a false-positive as far as I reviewed,
but we hate to be bothered by it. So let's revert it.

@Issue: https://github.com/thorvg/thorvg/issues/1409
2023-05-04 13:42:50 +09:00
Mira Grudzinska
11b36aa4c9 svg2png: changing image size
For resolution > 8k image's width and height are changed,
but the change was not applied to the image itself. Now fixed.
2023-05-04 09:54:43 +09:00
Mira Grudzinska
4599067bee svg_loader: fixing percent. calculations of width/height
The conversion to percentages was applied twice.
Additionally, when a viewbox value was provided before the width/height,
incorrect scaling occurred.

@Issue: https://github.com/thorvg/thorvg/issues/1414
2023-05-04 09:52:55 +09:00
Mira Grudzinska
21ac44d120 common: fixing log std stream
By mistake, stdout was switched to stderr
for logs. Fixed.
2023-05-04 09:50:33 +09:00
Hermet Park
f8c45cb175 examples image: ++sample svg 2023-05-03 22:08:16 +09:00
Hermet Park
9a9c0e7907 svg_loader: code refactoring.
simplify the logic and remove unnecessary member data.
2023-05-03 22:08:16 +09:00