Commit graph

29 commits

Author SHA1 Message Date
Hermet Park
24711e485c infra: renames the source folders
lib -> renderer
bin -> tools
utils -> common
2023-08-28 13:11:24 +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
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
cc1f86e719 canvas: ++ log msg for dev 2023-05-05 15:52:41 +09:00
Hermet Park
9b3c34c3b1 updated copyright. 2023-01-14 13:48:11 +09:00
Hermet Park
f0141e63de updated copyright date. 2022-01-12 14:08:48 +09:00
Hermet Park
13009657cd common canvas: supplement corner cases.
filled up corner cases to return the result properly.

Canvas newly has a drawing condition to prevent usage-violation.
2021-06-09 20:11:57 +09:00
Hermet Park
f0ecc670ef common canvas: return FailedAllocation if it really failed at memory allocation.
This fixes SwCanvasBase Reservation Unit Test.
2021-06-07 20:04:39 +09:00
Hermet Park
1a7d41ce71 updated copyright 2021-03-23 14:31:58 +09:00
Hermet Park
e9939dec82 common canvas: fix non-updated paints.
When shapes are poped from canvas while retaining shapes instances,
they have no chances to redraw after pushed again due to missing flag.

This patch fixes it by forcely updating flag on pushing time.

@Issues: 181
2021-01-20 23:20:51 +09:00
Hermet Park
bb4c6b299f common renderer: code refactoring.
renamed internal methods from flush() to sync()
since flush() is reserved for caching flush.
2020-11-06 15:26:47 +09:00
Hermet Park
8422e8c62b common canvas: revise clear method.
Canvas::clear() introduces a new argument "free" that deterimes freeing the retained paints.

If free is true, Canvas won't delete the retained paints so that user keep paints valid.

In this scenario, user must have paints pointers, free them manually or push them again to the canvas.

This scenario is useful if user wants to re-organize paints order in the list or reuse them.
2020-10-08 12:07:27 +09:00
Hermet Park
6365d02a96 optimization: cut off file dependencies.
we should avoid code insertion during file dependencies,
such as #include "xxx.h" which has implementations.

This could increase binary size, we can avoid it as possible.

Current patch improves binary size like this:

From: file(2059008) = text(120360) data(8096) bss(80) dec(128536)
To  : file(1921832) = text(118429) data(7872) bss(56) dec(126357)

More additional patches will come in to optmize binary size.
2020-09-23 20:57:30 +09:00
Hermet Park
eef7620bc8
common: binary optimization. (#65)
removed unique_ptr usages from pImpl pattern.
that increased binary size.

2204082 -> 2045672
2020-09-18 16:34:12 +09:00
Hermet Park
04c6295974 code refactoring
remove unnecessary condition.
implementation won't be included multiple times not like headers.

Thus this condition is unnecessary.

Change-Id: Id37e675c40ce7213a06c950da8e5ca17ff7245c9
2020-08-20 16:16:46 +09:00
Hermet Park
9893af979f replace license from Apache 2.0 to MIT
Change-Id: I61f7cb2b0e407bc035f3b2ec7da9b7f230057e24
2020-08-13 16:53:38 +09:00
Hermet Park
80d47fd7d3 common: revise canvas interfaces.
1. removed async option which doesn't work currently,
rather than it, we can add async option in initiailizer class.

2. removed update() method.
Instead, we can call update(paint = nullptr); which has exactly same behavior.

Change-Id: I7909a50d804b97baf413a2ff6365a3cf79a3689e
2020-07-30 13:43:18 +09:00
Hermet Park
afc7bc8c2f common: code refactoring
remove exceptional handling which is inevitable scenario.

Change-Id: I761a59a38f4578291ee8bc044c5ca989feedbe79
2020-07-29 19:53:45 +09:00
Hermet Park
4156de72f1 sw_engine: optimize rasterizey by threading it.
Also, newly introduced render interfaces: preRender(), postRender(), flush()

Change-Id: If506fa27e3c7dbd89f6734cad4774c1d151b88aa
2020-06-24 18:43:11 +09:00
Hermet Park
58de99aea3 common interface: replace arguements size_t to uint32_t
We prefer to build up a tiny compact engine at memory rather than compatibility,
this engine is not considerd for end-users but designed for middle-level framework
and some low-level users.

Thus, we won't consider 64bits data size,
use explicit 32 bits data until coming next upgrade...

Change-Id: I0704d5f1e0eb909cccc10922bc5972e115fbbcc0
2020-06-09 15:36:34 +09:00
Hermet Park
33e1d4b170 common interface: concrete return type.
Introduce Result type for notifying caller more detailed info.

We should implement the result values for each apis, with practical values.

Change-Id: Ia47abcb56a8efca7094ac3eed0178aeac8aa2910
2020-06-09 15:16:25 +09:00
Hermet Park
4ff97a6a40 common canvas: hide engine() interface
this engine() is not necessary by users,
we can hide this by moving out CanvasImpl class.

Change-Id: Iaf47dbd3c523e96d6af0bd1fd4caa11a7fd3778a
2020-05-04 21:27:41 +09:00
Hermet Park
211dafdaed common shape: refactored interfaces.
hide engine() interface of shape that's not friendly one by users.
instead canvas would access shape internal data to update/draw it.

Now Paint cannot update itself but has to request to Canvas for it.

Change-Id: Ibafd0864a65c3c33238789d1a3e06c49c4378349
2020-05-04 21:12:29 +09:00
Hermet Park
42c56757df common: redesigned interfaces
PaintNode -> Paint
ShapeNode -> Shape
SceneNode -> Scene

We can keep clean and neat shorter names.

Change-Id: Ic8521d456d947985e5fbe1ba2bde06faa1f52469
2020-05-02 18:20:50 +09:00
Hermet Park
0be7e0cf53 canvas: migrate render target clear call into draw();
Obivously, we need to clear target before drawing.

Thus canvas request to renderers to clear buffer.

the implementation is upto backend engines.

Change-Id: Ib80da7f2260b021bcfed9fa13fb91c20218f9da0
2020-05-02 17:33:41 +09:00
Hermet Park
a8864390e2 canvas: code refactoring
accept an extra argument in the clear() to clear paints node

and clear buffer selectively.

Change-Id: I83721e74358f546f325bb03fd1f36c7565174dd7
2020-05-02 11:25:07 +09:00
Hermet Park
5120a7ae12 canvas: correct convention
add missing noexcept option.

Change-Id: I14eacb0fdb2c9bd40e365bf81bb5cc0b73239ffe
2020-04-27 02:00:38 +09:00
Hermet Park
809dfd8644 canvas: add reserve() method.
This allocates nodes slots in advance to avoid memory grow & copy.

it will be benefit if you know how many shapes will be used in your canvas.

Change-Id: I7d93d166c9c054078bd86593d3471a2ade3671ee
2020-04-27 01:52:44 +09:00
Hermet Park
0e6faa9276 common: code refactoring.
introduce Canvas class to replace the CanvasBase.
now, SwCanvas, GlCanvas inherits this Canvas for polymorphism
and remove duplicated interfaces.

Change-Id: I65a87e3aa2289d04997930a54aeccd14f57dd73a
2020-04-27 01:48:48 +09:00
Renamed from src/lib/tvgCanvasBase.h (Browse further)