Hermet Park [Mon, 14 Dec 2020 03:29:37 +0000 (12:29 +0900)]
common sw_engine: apply partial composition.
Introduce RendererMethod::renderRegion() to return acutal drawing region info.
That is used by scene composition to composite actual partial drawing region
for better performance.
@Issues: 173
Change-Id: I5b3bb6cc37c1bc25c6f9f284f13e60da811d267b
Hermet Park [Thu, 10 Dec 2020 10:21:31 +0000 (19:21 +0900)]
sw_engine renderer: optimize composition data usage.
Use cache mechanism for composition data so that we don't reallocate
composition memory several times in one frame rendering.
@Issues: 168
Change-Id: I9b10618855822ae03c8684423683739c6dc248f6
Hermet Park [Thu, 10 Dec 2020 10:53:40 +0000 (19:53 +0900)]
examples Svg: replace a few example svgs.
Change-Id: I99c44c334492b6f9fc3b9fd614e1e4b8a12519b9
Hermet Park [Thu, 10 Dec 2020 05:23:29 +0000 (14:23 +0900)]
examples capi: fix a memory leak.
a shape is not cleaned properly.
@Issues: 178
Change-Id: Ib492fe23726d83b41fdd7b6e97cf68224449b0e5
Hermet Park [Thu, 10 Dec 2020 05:16:41 +0000 (14:16 +0900)]
sw_engine rle: fix an invalid memory access.
There is a mistake that over-access boundary.
This fix it.
@Issues: 178
Change-Id: I0f4d9f763eb75ebb16ccb89dedbb356e9833af97
Hermet Park [Thu, 10 Dec 2020 02:57:38 +0000 (11:57 +0900)]
loaders: fix memory leak.
While looking for image loader, it occured memory leaks.
Fixed it properly.
@Issues: 178
Change-Id: If09be510b28a0c0374254779fe8a2f82c3251d6d
Hermet Park [Thu, 10 Dec 2020 02:48:08 +0000 (11:48 +0900)]
sw_engine stroke: fix memory leak.
Properly free data after use.
@Issues: 178
Change-Id: I085fd936081c82f9ea4d332979a90fe276d0e0cc
Hermet Park [Thu, 10 Dec 2020 01:47:08 +0000 (10:47 +0900)]
tools: remove invalid file link.
Change-Id: If6595d2cec8cadf09b152a367196f99445a8236e
pkosko [Thu, 10 Dec 2020 01:38:22 +0000 (02:38 +0100)]
tools: Automatic code format tool added
Tool allows auto formatting of code according to Google coding standard
for easier control and fixing formatting issues.
Change-Id: I1103cf899ff7ab0673faba02dbf2b588d1853593
Hermet Park [Wed, 9 Dec 2020 10:56:59 +0000 (19:56 +0900)]
common sw_engine: code refactoring & stabilizing.
Apply tvg Array instead of std::vector
Also Fixed to compList in update() to passed by reference, not copying.
Also Fixed Composition Target memory leak
Here is the binary size result:
[libthorvg.so] 1785376 >> 1607416
[text] 121255 >> 118277
[data] 7792 >> 7736
[dec] 129119 >> 126085
Change-Id: I70ac0148ca69b4f38dd93099eab55259f9d5abe7
Hermet Park [Wed, 9 Dec 2020 05:58:37 +0000 (14:58 +0900)]
fix typo
Change-Id: Iaeb329aff16c13ca6c625d83ee57a3970f991f3a
Hermet Park [Wed, 9 Dec 2020 05:48:48 +0000 (14:48 +0900)]
common array: Introduce Array function to common.
This Array is promoted from SvgVector to use it widely in tvg.
It's similar with std::vector, we can use it instead of it.
Also, svg_loader replaced with it subsequently.
Change-Id: I1ddca958508ed7ceae9f173c6f8167b5318e1604
Hermet Park [Wed, 9 Dec 2020 05:07:13 +0000 (14:07 +0900)]
svg_loader: code refactoring
Use custom vector data algorithm for optimizing binary size.
Plus remove tuple usage since it leads unnecessary instance copying.
binary size comparison:
[libthorvg.so] 1811400 >> 1785448
[text] 122914 >> 121255
[data] 7824 >> 7792
[dec] 130810 >> 129119
Change-Id: Ie14679c886b42f7db0b4f612e7c6a62eaec8cb7b
Hermet Park [Tue, 8 Dec 2020 11:26:06 +0000 (20:26 +0900)]
sw_engine renderer: code refactoring.
Unify Shape+Stroke composition with CompositeCtx which is added for Scene Composition
This fixes clipping issue as well.
@Issues: 164
Change-Id: I34aaffcaea59b170c0ef3746af67294b2354e4d9
JunsuChoi [Mon, 7 Dec 2020 08:35:26 +0000 (17:35 +0900)]
svg_loader SceneBuilder: No propagate opacity to child
Scene's opacity() propagates opacity value inside.
Therefore, unnecessary opacity calculation.
Change-Id: Ic7460c21b28aaa8bc1ed81272d63ef2931732b52
Hermet Park [Mon, 7 Dec 2020 07:57:28 +0000 (16:57 +0900)]
wasm: code refactoring.
Use Picture::size() method instead of scale()
Picture newly supports size() method to resize image.
It's more convenient for users in its usage.
Change-Id: I78e7ba4487afc0654c757a6298b705cc3241e76d
Hermet Park [Tue, 8 Dec 2020 03:27:13 +0000 (12:27 +0900)]
picture: replace size parameter to float.
Considering smooth-resizing on sub-pixeling.
Change-Id: I3321e88a92b9af635f6ad3f7eb5bf89f2192f6d6
Hermet Park [Mon, 7 Dec 2020 10:52:56 +0000 (19:52 +0900)]
sw_engine renderer: fix a crash issue.
This stroking composition condition must be initialized
even when exceptional cases. We moved the condition setting to
handle it always.
Change-Id: I532b5819d3d560f51611c3be06101ecc7c9197a0
Hermet Park [Mon, 7 Dec 2020 06:45:44 +0000 (15:45 +0900)]
sw_engine renderer: support scene opacity composition
this is an additional enhancement of
af8c278c5e2a47c21f44440cdb0a7aaf6f6d3baa
Now scene opacity composition is supported.
Also, this implementaion fixes an incorrect scene bounding box computation.
Plus, adding stroking feathering to shape bounding box size.
Change-Id: Ic74f2667ca1858b32b67135b3da0354fd2f6bfc5
Hermet Park [Fri, 4 Dec 2020 09:47:29 +0000 (18:47 +0900)]
common picture: revise resize method.
this implementation handles the center-aligned scale.
Also removed viewbox usage since we have size() method.
Change-Id: I9249c12d6eaf429e62ad8a8f0b776f00b50d779f
JunsuChoi [Fri, 4 Dec 2020 06:03:25 +0000 (15:03 +0900)]
common Picture : Introduce Picture's size setter, getter APIs
* common Picture : Introduce Picture's size setter, getter APIs
If picture or file loaded by picture has an explicit Size(width, height),
it is transformed to fit the size.
Change-Id: Ie0b2530a5113b619f7de9d73197ddedb4ef13f99
Hermet Park [Thu, 3 Dec 2020 06:29:40 +0000 (15:29 +0900)]
sw_engine renderer: refactoring code & optimize composition.
Move the prepare stage of shape & stroking composition stage to a separate function
this returns SwImage to use in composite stage.
Also clear partial region buffer since we know composition area.
Change-Id: I68cf6c8a8e4ca36960c917b88fdd2c74f7a494a3
JunsuChoi [Wed, 2 Dec 2020 08:32:58 +0000 (17:32 +0900)]
svg_loader Loader,XmlParser: String that has not been parsed returns false
Existing parser functions always return true.
Parser function's return value was not being properly used.
So, add a return to check whether it is parsed or not.
Change-Id: I7e8a0b02dd22858d2150ec711abc3ba890d9c884
JunsuChoi [Thu, 3 Dec 2020 05:21:28 +0000 (14:21 +0900)]
svg_loader SceneBuilder: Use opacity() without using alpha color
If opacity value is set in node,
opacity() API is used without composing alpha color.
Change-Id: I949454a346b60eb5e32d828784a56c36c4c45977
Hermet Park [Thu, 3 Dec 2020 09:26:21 +0000 (18:26 +0900)]
sw_engine math: fix regression bug.
There is 1 pixel misaligned issue observed.
Found out transform() increases 0.5 pt always.
This transform() logic was broken by this change -
e00f94870510636789dce3702ab651b82b8047ee
and now recorvered to origin.
Change-Id: I05ca6cf4c20f952d8d4c3695a74abf275c1e1b53
Hermet Park [Wed, 2 Dec 2020 08:16:15 +0000 (17:16 +0900)]
sw_engine raster: support opacity composition.
This implementation supports shape + stroke opacity composition.
Currently, tvg shape provides individual alpha values for filling & stroking
These alpha values are working individually, meaning that if stroking is half translucent,
user can see that translucent stroking is crossed the shape outlines.
Sometimes this result can be expected but user also expects the shape filling is invisible
behind of translucent stroking.
For this reason, Paint provides an additional api opacity()
that applies opacity value to whole paint attributes.
This is a little expensive job, please consider if you can possibly avoid that usage.
See Opacity example.
@Issues: 94
Change-Id: I856a67a986e724cb83b484782ce3499aa95455d2
Hermet Park [Wed, 2 Dec 2020 07:49:53 +0000 (16:49 +0900)]
sw_engine raster: code refactoring & optimize code.
* sw_engine raster: code refactoring & optimize code.
1. move the computation out of rolling if possible.
2. renamed internal variables & function prototypes.
Change-Id: Ibfdf82a5b6a4f004f5a64c42d8cbea01c62943dc
Hermet Park [Tue, 1 Dec 2020 07:13:51 +0000 (16:13 +0900)]
gl_engine renderer: fix build break.
interface has been changed. make it up-to-date
Change-Id: I92a7cb1a3df5e0df701bb30506f646c944a47e22
Michal Szczecinski [Thu, 26 Nov 2020 08:31:32 +0000 (09:31 +0100)]
common capi: Added scene clear API
Scene::clear() API allows users to remove shapes on their own, without
a crash in paint->dispose() or tvg_paint_del() methods. This case is
needed especially when thorvg is used to draw frames, when in one frame
we have scene with shape, and in next frames (future time stamps) user
deletes shapes
@API additions
Result Scene::clear();
Tvg_Result tvg_scene_clear(Tvg_Paint *scene);
Example:
```c
Tvg_Paint *scene = tvg_scene_new();
Tvg_Paint *shape = tvg_shape_new();
tvg_scene_push(scene, shape);
tvg_scene_clear();
//Now we can safelly free resources manually
tvg_paint_del(scene);
//Without tvg_scene_clear() memory allocatad for shape was double released
tvg_paint_del(shape);
```
Change-Id: I1b2a52262c0a5db723eba05ebc9867d901ac2932
JunsuChoi [Mon, 30 Nov 2020 05:51:04 +0000 (14:51 +0900)]
common Scene: Fix validation check for child's bounds
Fix typo. and Change return to continue.
Even if the child's boundary calculation is wrong,
other child's boundary should be calculated.
Change-Id: I7e3a73046bef3eee26592a66e0d46bff2a733c8f
JunsuChoi [Mon, 30 Nov 2020 05:50:05 +0000 (14:50 +0900)]
common Test: Add Paint.bounds unit test
Change-Id: I0d99925afc9a942c65098a6f8c39c6ad9cb4d700
JunsuChoi [Mon, 30 Nov 2020 06:20:49 +0000 (15:20 +0900)]
sw_engine Raster: Add null check for transform
If transform is null, identify matrix is used.
Change-Id: Ia01b687c3894354cafd80fc4fe944c0b4756718d
Michal Maciola [Thu, 26 Nov 2020 10:27:05 +0000 (11:27 +0100)]
Picture capi binding
Change-Id: I83af4cf0ee4452041057e097a1f64a08862607bf
Michal Szczecinski [Mon, 30 Nov 2020 04:08:24 +0000 (05:08 +0100)]
capi: Added fill rule API.
Added capi binding for fill rule setter and getter.
@API changes:
enum Tvg_Fill_Rule {
TVG_FILL_RULE_WINDING = 0,
TVG_FILL_RULE_EVEN_ODD,
}
Tvg_Result tvg_shape_set_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule rule)
Tvg_Fill_Rule tvg_shape_get_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule* rule)
Change-Id: If83a08dfaceb4e861085de8a38d86d3e321cc64f
Hermet Park [Mon, 23 Nov 2020 09:33:10 +0000 (18:33 +0900)]
examples: ignore loading raw image file.
in the last commit, it added a raw image file in the images folder.
It breaks Multicanvas, Svg which try to load all kinds of files in it.
We don't need to load all files by figuring out file extension name.
Change-Id: Iecea64379fabd85aa636158740a224a43ebc89c0
JunsuChoi [Mon, 23 Nov 2020 09:12:36 +0000 (18:12 +0900)]
raw_loader Loader: Introduce Raw image loader
Add RawLoader class that loads and display raw images,
and adds a Rasterizer for image data.
Image data can be loaded via picture.
Loaded image supports Composition, Transformation and Alpha blending.
New API
Result load(uint32_t* data, uint32_t width, uint32_t height, bool isCopy) noexcept;
Change-Id: I180863466f833586df1fa47fee86dd72e45f1368
Michal Szczecinski [Thu, 19 Nov 2020 06:39:07 +0000 (07:39 +0100)]
capi: Added free flag to clear API.
Cpp implementaiton of library has free flag which was not used in
capi bindings.
@API changes
from: tvg_canvas_clear(Tvg_Canvas *canvas);
to: tvg_canvas_clear(Tvg_Canvas *canvas, bool free);
Change-Id: I4e7f5ced229dbd449dc5c2e2e1148f43d37bc50e
Hermet Park [Wed, 11 Nov 2020 04:55:46 +0000 (13:55 +0900)]
common taskScheduler: code refactoring
removed unnecessary code.
Change-Id: I0e02fa8c2d8e33678b42bd88412b562afd551b86
Subhransu Mohanty [Tue, 10 Nov 2020 07:43:19 +0000 (16:43 +0900)]
common taskScheduler: fix a synchronization data race.
std mutex shouldn't be used among threads. behavior is unexpected by implmentation.
This resolves it by introducing conditional value.
Change-Id: I276fab65919b979f0f4a882ef52214bda6a69bde
Michal Szczecinski [Tue, 10 Nov 2020 03:13:48 +0000 (04:13 +0100)]
capi examples: Added scene API C bindings.
Scene CAPI allows to use scene functionaliy in C applications such as
set opacity to few shapes at one time or implement transparent layers.
@API Additions:
```c
Tvg_Paint* tvg_scene_new();
Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size);
Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint *paint);
```
Examples:
```c
Tvg_Paint *scene = tvg_scene_new();
Tvg_Paint *shape1 = tvg_shape_new();
tvg_shape_append_rect(shape1, 10, 10, 100, 100, 0, 0);
tvg_shape_set_fill_color(shape1, 255, 0, 0, 255);
Tvg_Paint *shape2 = tvg_shape_new();
tvg_shape_append_rect(shape2, 120, 10, 100, 100, 0, 0);
tvg_shape_set_fill_color(shape2, 255, 0, 0, 255);
tvg_scene_push(scene, shape1);
tvg_scene_push(scene, shape2);
tvg_paint_set_opacity(scene, 100);
tvg_canvas_push(canvas, scene);
```
Change-Id: I0043826fbddd8aa5d523f68bb271144f8c39e35c
Co-authored-by: Michal Szczecinski <m.szczecinsk@partner.samsung.com>
Hermet Park [Mon, 9 Nov 2020 05:43:15 +0000 (14:43 +0900)]
examples capi: removed printf()
there is no point to print information.
Change-Id: Ic18abdf4da21d17d215384c1198c1e7732cb22d5
Hermet Park [Mon, 9 Nov 2020 05:36:22 +0000 (14:36 +0900)]
common taskScheduler: thread sync optmization
replaced future/promise with mutex since they use a lot of memory allocation number.
plus, binary size is reduced from 2094896 -> 1746864
Change-Id: Iea8cf9c8336e50d1272aa512f3a4d8b35d182534
Hermet Park [Fri, 6 Nov 2020 06:37:17 +0000 (15:37 +0900)]
Revert "examples: revise example code."
This broke gl_engine rendering, revert it.
This reverts commit
9bb1972ef97e1ae3c83fe9e48c16262d9f246a4a.
Change-Id: I7304fd73c77ae3487681e2241a9d47f7c5b686f7
Hermet Park [Fri, 6 Nov 2020 06:19:52 +0000 (15:19 +0900)]
common renderer: code refactoring.
renamed internal methods from flush() to sync()
since flush() is reserved for caching flush.
Change-Id: I14c2f5b530907d573a2400f3cbd01dad1aaef0af
Hermet Park [Fri, 6 Nov 2020 06:25:11 +0000 (15:25 +0900)]
gl_engine renderer: fix build break.
just found a missing change for the fillColor api.
Change-Id: Ife45e37a02ba7fb1beba324f81801ab0ea758548
Hermet Park [Fri, 6 Nov 2020 04:38:00 +0000 (13:38 +0900)]
sw_engine mempool: ++optimization
These memory pools requires very simple mechanism.
Remove stl vector but use direct memory for less binary size.(2127696 -> 2094094)
@Issues: 75
Change-Id: Id13d3dc0b6425457858921e1f7b43c747af17272
Hermet Park [Fri, 6 Nov 2020 02:18:35 +0000 (11:18 +0900)]
common shape: memory optimization
All shapes will have path data,
avoid unnecesary dynamic memory allocation internally.
@Issues: 75
Change-Id: Ib3eefcf962ea391229668710aab364bd6cbd18c3
Hermet Park [Fri, 6 Nov 2020 02:30:31 +0000 (11:30 +0900)]
updated AUTHORS
Change-Id: I978fe66900b8b15d93da79f3576843d9f08e4bd3
Vincent Torri [Thu, 5 Nov 2020 11:25:47 +0000 (12:25 +0100)]
fix compilation on Windows
Change-Id: I1afe19b0ed0a98c1488871e1ac3f0a4be8cde816
Vincent Torri [Thu, 5 Nov 2020 10:36:43 +0000 (11:36 +0100)]
fix compilation on Windows
Change-Id: Ie1cfe437abb250c87389e2f122cb2fda0c50e8dc
Hermet Park [Thu, 5 Nov 2020 07:34:14 +0000 (16:34 +0900)]
sw_engine rle: performance optimization.
Tis is a subsequential trial of
1b8188ee676eae5c690b1b88bb823b6ad126bb78
for opimizing memory alloc count.
In this time, it concentrates on rle span.
@Issues: 75
Change-Id: Ie7a0324c33856b2ac938f4300a280b5fb6d3b39f
Hermet Park [Thu, 5 Nov 2020 05:44:43 +0000 (14:44 +0900)]
Update README.md
Change-Id: I4022490bb0a206b5cbd77deeb0720de4d0b483dd
Hermet Park [Thu, 5 Nov 2020 05:43:32 +0000 (14:43 +0900)]
Update README.md
Change-Id: I8f7343ae0c3b41f6c1672afda40d1de4f1a7bd91
Hermet Park [Thu, 5 Nov 2020 04:57:21 +0000 (13:57 +0900)]
Update CONTRIBUTING.md
Change-Id: I5d7e3c08106c05912be07537fd7ddc09311da19b
Hermet Park [Wed, 4 Nov 2020 12:01:22 +0000 (21:01 +0900)]
Update README.md
Change-Id: Iddf24b5580e6157a966d1c38fde40a16c93adb4c
Hermet Park [Wed, 4 Nov 2020 11:58:54 +0000 (20:58 +0900)]
res: updated thorvg card images.
Change-Id: Ic527aad2533ea9de0b15a7e6f8d164b5bda2e880
Hermet Park [Wed, 4 Nov 2020 10:58:14 +0000 (19:58 +0900)]
sw_engine mempool: performance optimization.
This is a subsequential trial of
1b8188ee676eae5c690b1b88bb823b6ad126bb78
for opimizing memory alloc count.
In this time, it concentrates on stroke outline.
@Issues: 75
Change-Id: I0f73b83cb7aee51186455d2312fa77cdb434ab3d
Hermet Park [Wed, 4 Nov 2020 10:20:29 +0000 (19:20 +0900)]
sw_engine mempool: changed caching policy.
for smart usage, clear memory only when engine is terminated.
Change-Id: I377fd6f1953a50b64945cbf0e84c882aa1cb92d8
Hermet Park [Wed, 4 Nov 2020 10:18:59 +0000 (19:18 +0900)]
common sw_engine: code refactoring
replaced names and fixed out of coding convention.
Change-Id: I1a2f17a3da6ea38e7ef2c00ff787323267439e0e
Hermet Park [Wed, 4 Nov 2020 08:56:33 +0000 (17:56 +0900)]
examples: revise example code.
Move the Clear call to the end of drawing those scenarios doesn't need to retain paints resources.
We should show the examples as the best usage.
@Issues: 75
Change-Id: Ieea116077e578742d627b71fb5fad395a74dbc9d
Hermet Park [Wed, 4 Nov 2020 07:28:47 +0000 (16:28 +0900)]
sw_engine shape: performance optimization.
we introduced shared memory pool for avoiding reallocate memory
while it process the stroke outlines, It experimentally increase
the outline data if we use the allocated memory for multiples shape strokes,
we don't need to alloc/free memory during the process.
This shared outline memory is allocated for threads count
so that we don't interrupt memory access during the tasks.
@Issues: 75
Change-Id: I2794c4368e392fa774a5cf9a9fc771963427269a
Hermet Park [Wed, 4 Nov 2020 02:46:49 +0000 (11:46 +0900)]
res: polishing example pictures.
Change-Id: I83f085a843425d9f747183cd99dce2800a6ac706
Hermet Park [Wed, 4 Nov 2020 02:33:27 +0000 (11:33 +0900)]
Update README.md
Change-Id: I34d108e90bea2fb5278d3f0e2202730b270c37ab
Hermet Park [Wed, 4 Nov 2020 02:32:27 +0000 (11:32 +0900)]
Update README.md
Change-Id: Ie28f9b92e5ee8ec20966b6cedc7d1b6b40cdec4d
Hermet Park [Wed, 4 Nov 2020 02:28:34 +0000 (11:28 +0900)]
res: adds working-flow picture.
this picture will be used in README.
Change-Id: Id9f1ce6df61a19ce1bdefd302d5c809dd6a191d4
Michal Szczecinski [Tue, 3 Nov 2020 11:42:57 +0000 (12:42 +0100)]
common capi: Added opacity C bindings.
Added opacity setter/getter to CAPI. They will be useful to simplify
code responsible for set visiblility of paint.
@API Additions:
Tvg_Result tvg_paint_set_opacity(Tvg_Paint* paint, uint8_t opacity)
Tvg_Result tvg_paint_get_opacity(Tvg_Paint* paint, uint8_t* opacity)
Change-Id: Ifeae545d12d74f316b8d27b5e047c55f82a696fe
Hermet Park [Tue, 3 Nov 2020 07:23:29 +0000 (16:23 +0900)]
Update README.md
Change-Id: I19b6f77d80640ee7791e85a93cc2c1e38d92fcb7
Hermet Park [Tue, 3 Nov 2020 05:48:40 +0000 (14:48 +0900)]
Update README.md
Change-Id: I64a0d9afe5795fbd3305e7ac7ba4cb04026e522d
Hermet Park [Tue, 3 Nov 2020 05:45:52 +0000 (14:45 +0900)]
res: updated example screenshot resources
Change-Id: I4605c2b57206b447b40358e1272ecbf280fb8639
Hermet Park [Tue, 3 Nov 2020 05:45:44 +0000 (14:45 +0900)]
Update README.md
Change-Id: I0758a443349254d54e2dc7b86bd79d2a8b5bfa85
Hermet Park [Tue, 3 Nov 2020 05:42:33 +0000 (14:42 +0900)]
Update README.md
Change-Id: I5c713c8c3edeaae4f7a1fdddb436fca51e0331ff
Hermet Park [Tue, 3 Nov 2020 05:40:51 +0000 (14:40 +0900)]
res: replaced primitive example screenshot.
Change-Id: I243b0790ad7bf9649fcc992caae8371324497cda
Hermet Park [Tue, 3 Nov 2020 05:26:05 +0000 (14:26 +0900)]
Update README.md
Change-Id: I15dd7878ec85d703ee4af8ec9afeece171afc90a
Hermet Park [Tue, 3 Nov 2020 05:25:00 +0000 (14:25 +0900)]
Update README.md
Change-Id: I4059109d548b47cbeb170fcb2175e8d00ffaf0f4
Hermet Park [Tue, 3 Nov 2020 04:40:47 +0000 (13:40 +0900)]
common LoaderMgr: code refactoring
keep clean & neat thorvg coding style.
Change-Id: I9525b37922fd7a273677fb8522e7257d9d4fb611
Hermet Park [Tue, 3 Nov 2020 05:19:31 +0000 (14:19 +0900)]
res: adds primitive example screenshot.
Change-Id: I35fe24913d5f7e71436286b052c8e86a2ef75968
Hermet Park [Tue, 3 Nov 2020 05:07:58 +0000 (14:07 +0900)]
Update README.md
Change-Id: I91e6118d1c190397e687c9aff2f1d4623873967b
JunsuChoi [Thu, 22 Oct 2020 04:10:48 +0000 (13:10 +0900)]
svg_loader LoaderMgr: Delegates file validation check to LoaderMgr.
Delegates extension string check and header(open) check
for file to LoaderMgr.
This makes it easy to add a loader afterwards.
Change-Id: I93b355cdc78fe371b77ada56fe08e4dc47e0d5d5
Hermet Park [Mon, 2 Nov 2020 10:25:36 +0000 (19:25 +0900)]
sw_engine shape: code refactoring.
thorvg always prefer simpler code, less LOC.
Change-Id: I93a1314f5cd96c5080360f622940cf239e698c2e
Mira Grudzinska [Sun, 1 Nov 2020 15:38:14 +0000 (16:38 +0100)]
sw_engine shape: change of the rectangle fast tracking algorithm
The algorithm erroneously treated some shapes (like isosceles trapezoids
and specifically arranged zero width parallelograms) as rectangles,
which causes the whole bbox to be filled.
Change-Id: If5aa87c53cf174367841323ac813b28ead4871b4
JunsuChoi [Thu, 29 Oct 2020 08:48:09 +0000 (17:48 +0900)]
svg_loader: Fixed a typo
lenght ->length
Change-Id: I0d05b3ff1ae5dc6c8330a3f29a290feacd705c00
JunsuChoi [Thu, 29 Oct 2020 10:45:21 +0000 (19:45 +0900)]
test Canvas: Set up unit test based on gtest.
In test directory, set up unit_test based on gtest
First, add a test for SwCanvas generate.
Change-Id: I2b7ab96b5f7bc17408cc43cebda2ec731f73d1e7
JunsuChoi [Fri, 30 Oct 2020 02:54:03 +0000 (11:54 +0900)]
common lib/loaders: Fix missing space for coding convention
Correct missing or incorrect spaces according to coding convention.
Change-Id: If90d7c1926a99fe0ee6847920a8c08ecf6cec89f
JunsuChoi [Fri, 30 Oct 2020 03:07:15 +0000 (12:07 +0900)]
svg_loader SvgLoader: Fix wrong indentation
indent 3 -> 4
Change-Id: I9578df16f1300adff507e416bd1cd06646e4a58f
JunsuChoi [Fri, 23 Oct 2020 02:55:07 +0000 (11:55 +0900)]
svg_loader SvgLoader: Prevent memory overflow for tagName
When copying tagName, if length of referenced string is longer
than general case, it is not used as tagName.
Change-Id: I205b4eb58f97a75bed43caafe55de8f56e6700d4
Hermet Park [Mon, 26 Oct 2020 09:57:11 +0000 (18:57 +0900)]
common paint: introduce opacity() method.
We introduced separate opacity interface to adjust alpha value by paint.
This opacity will affect to whole paint image if paint is a group of paints.
Also, this opacity is to multipy with fill/stroke alpha values.
This means if the opacity is valid, the paint might deal with a composition step,
which is very expensive due to additional rendering step.
One tip is, if you want to toggle on/off for a certian paint,
you can set opacity to 255 or 0.
@API Additions:
Result Paint::opacity(uint8_t o) noexcept;
uint8_t Paint::opacity() const noexcept;
@Examples: examples/Opacity
@Issues: 94
Change-Id: Ie291890304230c34006fbe7f96a8707e01d9439c
Hermet Park [Mon, 26 Oct 2020 08:13:02 +0000 (17:13 +0900)]
xexamples fillrule: revise code.
just adjusted start points for better visual.
Change-Id: Ib1a121e5acd375bedc737cc56c2f9f5549ab110d
Hermet Park [Mon, 26 Oct 2020 07:52:52 +0000 (16:52 +0900)]
examples svgs: replace logo design resource.
White background is our official thorvg logo,
cyan is for Tizen customed.
Change-Id: Ic32b4cd9349daef7cb9eaea91da69f5b7b734cd8
Mira Grudzinska [Mon, 26 Oct 2020 01:13:30 +0000 (02:13 +0100)]
sw_engine shape: adding a dash pattern switch condition
Preventing switching to the next dash pattern for a line with a length of zero.
Change-Id: I364a39cbf99f14d0a3563c65f7523c288fe97a6d
Mira Grudzinska [Thu, 22 Oct 2020 23:32:52 +0000 (01:32 +0200)]
common shape: handling dash patterns < 1
For the dash pattern values (both, length and gap) < 1 the program crashed.
curLen - variable type changed from int to float.
Change-Id: I9a50f1d247c210de7e5017b652554d94f00eb875
Hermet Park [Thu, 22 Oct 2020 12:01:55 +0000 (21:01 +0900)]
common api: interface refactoring
returning color fill() method renamed to fillColor() as like others-strokeXXX, fillRule- do.
This change is for naming consistency.
Change-Id: I8022219514b829e78097ac2f308688129d586a05
Hermet Park [Thu, 22 Oct 2020 08:14:29 +0000 (17:14 +0900)]
sw_engine shape: support fillRule method
this change supports EvenOdd fillrule in shape rendering
@Examples: examples/FillRule.cpp
@Isuses: 97
Change-Id: Iff5ce7228cff607131a4725fb9b335561fc883d8
Hermet Park [Thu, 22 Oct 2020 05:55:22 +0000 (14:55 +0900)]
sw_engine renderer: fix aliasing shape outline result.
There a scenario detected that stroke 2 is not enough to cover
shape outlines. So make it bigger size.
Change-Id: Ic1042706ef8af1aa5d57f77e438e671faded4188
Hermet Park [Thu, 22 Oct 2020 04:36:29 +0000 (13:36 +0900)]
examples FillRule: added shape::fillRule() example
one shape shows Winding, the other one shows EvenOdd.
Change-Id: I5e0280c1caf72b2533cf1c40da232e0d984abb39
Hermet Park [Tue, 20 Oct 2020 10:36:26 +0000 (19:36 +0900)]
common fill: add fill-rule interface.
Fill rule is used to select how paths are filled.
For both fill rules, wheter or not a point is included in the fill is determined by taking a ray
from that point to infinity and looking at intersections with the path. The ray can be in any
direction, as long as it doens't pass through the end point of a segment or have a tricky
intersection such as intersecting tangent to the path.
@API Addtions:
enum class TVG_EXPORT FillRule { Winding = 0, EvenOdd };
Result Fill::rule(FillRule r) noexcept;
FillRule Fill::rule() const noexcept;
@Examples:
shape->rule(FillRule::EvenOdd);
@issue: 97
Change-Id: Ia282acd5f9d6154216683c1a65369a9a48220544
Mira Grudzinska [Thu, 15 Oct 2020 20:10:56 +0000 (22:10 +0200)]
Bezier curve: introducing BEZIER_EPSILON
BEZIER_EPSILON is used instead of EPSILON_FLT, because its
value was to small causing in some cases an infinite loop.
Change-Id: I90e25aed0d6138c2927d96cbbfea02e56d83c9ed
Hermet Park [Thu, 15 Oct 2020 11:37:53 +0000 (20:37 +0900)]
svg_loader XmlParser: just renamed file name to simplify.
XmlParser without "Simple" is enough to address itself.
Change-Id: Ib2d41d75674763be9e2757bb05c592d5fa655eaa
Shinwoo Kim [Thu, 15 Oct 2020 05:33:40 +0000 (14:33 +0900)]
wasm test: update sample index.html
Update index.html according to updated wasm interface.
Missed chance to update index.html during review.
Change-Id: Ib2ada27619e3bee6d500f0804209dbac076be30f
Hermet Park [Thu, 15 Oct 2020 03:14:50 +0000 (12:14 +0900)]
Update CONTRIBUTING.md
Change-Id: I8cd6512b93c91f9b7f190980b4422efa53e7e6d0
Hermet Park [Thu, 15 Oct 2020 03:09:08 +0000 (12:09 +0900)]
Update CONTRIBUTING.md
Change-Id: I03e3f6c3d2dc1f0f96a2bbae5432a801402dae1d