Commit graph

37 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
a1f0b06f41 common array: revise code.
maintain code with an optimial size.
2023-07-25 19:57:12 +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
9b3c34c3b1 updated copyright. 2023-01-14 13:48:11 +09:00
Rémi Verschelde
46c3fc1f94 Format code files with dos2unix, ensure newline at EOF 2022-07-10 23:21:05 +09:00
Hermet Park
f0141e63de updated copyright date. 2022-01-12 14:08:48 +09:00
Hermet Park
1592443c3e common paint: improve rotation condition precision
cover the four cases: 0, 90, 180, 270 degrees...
2021-11-12 19:45:01 +09:00
Hermet Park
d520da2db8 sw_engine image: optimized image rendering.
Applied the fast-track routine for axis-aligned images.
This helps to remove outline generation if no clips.
2021-11-12 16:28:15 +09:00
Hermet Park
c3a29bd648 common math: code refactoring
introduce common math functions to improve the reusability.
2021-11-04 17:11:27 +09:00
Mira Grudzinska
abc3b40a37 sw_engine: var/funct renaming
Changed names:
shape->rect -> shape->fastTrack
_factTrack -> _axisAlignedRect
2021-11-02 11:41:14 +09:00
Mira Grudzinska
362d2dfd0f sw_engine: refactoring
The rasterization region was rearranged in the case of fastTrack,
but its validation and boundaries weren't check, causing segf in some
cases. Fixed.
2021-10-29 10:52:29 +09:00
Mira Grudzinska
8cfe4ef708 sw_engine: including gradient transformation into gradient preparation
The gradient transformation has to be taken into account as the last
step of the gradient preparation.
2021-10-25 19:31:38 +09:00
Mira Grudzinska
7b778cd878 sw_engine: proper linear gradient transformation
In the case of any shape transformation, the gradient fill
was not correct.
2021-10-25 19:31:38 +09:00
projectitis
dad6c71b6c
all: fix warnings on MSVC
* Explicit casts to suppress warnings
* Fixed compiler warnings
2021-10-09 11:33:45 +09:00
Mira Grudzinska
e7c3a91aa1 all: fixing clang warnings
fopen->fopen_s, strdup -> _strdup, strncpy -> strncpy_s
__declspec(dllexport) -> __attribute__ ((visibility ("default")))
2021-10-06 11:13:12 +09:00
Michal Maciola
934a95777c
common: style fixes (#644) 2021-07-22 13:35:26 +02:00
Hermet Park
59f189bcb4
Update tvgSwMath.cpp
fix typo.
2021-06-23 22:46:41 +09:00
Hermet Park
bba162b604 sw_engine: fix MSVC compatibility problem.
clz (count leading zero) is builtin function
that is not available in MSVC.

This patch replace clz for MSVC env.

Thanks @fire for pointing out this.

Refers: https://stackoverflow.com/questions/355967/how-to-use-msvc-intrinsics-to-get-the-equivalent-of-this-gcc-code
2021-06-23 16:26:31 +09:00
Hermet Park
d2c04f6037 wasm: fix compile errors. 2021-04-09 22:18:57 +09:00
Hermet Park
f1fe36d8f6 common sw_engine: optimize single rectangle ClipPath.
If ClipPath is a singular rectangle,
we don't need to apply this to all children nodes to adjust rle span regions.

Rather than its regular sequence,
we can adjust render region as merging viewport that is introduced internally,

All in all,
If a Paint has a single ClipPath that is Rectangle,
it sets viewport with Rectangle area that viewport is applied to
raster engine to cut off the rendering boundary.

In the normal case it brings trivial effects.
but when use SVGs which has a viewbox, it could increase the performance
up to 10% (profiled with 200 svgs rendering at the same time)

Note that, this won't be applied if the Paint has affine or rotation transform.

@Issues: 294
2021-03-26 17:10:35 +09:00
Hermet Park
4a8f45577a
sw_engine: code refactoring
1. unified clip & bounding box in rle processing
2. unified outline boundingbox functions between shape & image.
2021-03-24 18:48:39 +09:00
Hermet Park
1a7d41ce71 updated copyright 2021-03-23 14:31:58 +09:00
Mira Grudzinska
229a013fcd sw_engine math: fixing matrix transformation
Unnecessary rounding during matrix transformation has been removed.
The problem occured when scaling a shape with a dashed stroke.
2021-02-22 11:15:11 +09:00
JunsuChoi
08c37978a9 common: Pointer that can declare const are refactored to use const
Pointer and reference parameters should be "const" if the corresponding object is not modified
2021-02-19 16:51:50 +09:00
Hermet Park
ee1522a446 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 - e00f948705
and now recorvered to origin.
2020-12-03 18:30:47 +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
9d58643a6c sw_engine: fix loss of data when it's converting.
if SwCoord type is determined to 4byte,
it could lose remarkable value that occur stroking jiggling.

This fixes the issue.

Change-Id: Ib2fed2a3bfc9188a30522f35837439364d446a73
2020-08-20 12:18:51 +09:00
Hermet Park
ffa4a7248b code refactoring
Now, stabilizing is pretty enough.

Remove assert code so that we never abort process in any cases.
This also reduce the binary size.

Change-Id: Ia7d2d5c5a0757b12481eaebad7a86aade6a89c1e
2020-08-19 14:53:38 +09:00
Hermet Park
ac4405a4ec sw_engine: fix potential data overflow.
Change-Id: Ie800fda74d44ad3741f7a92f12681f7f753ee50c
2020-08-13 19:50: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
ef11d500ba common: fix compiler warnings that loss data by mis-matched converision
these conversions are intented, we explicity use casting so that compiler doesn't
catch them anymore.

Change-Id: I9d905c7562c43929b040d034e5ee0d14c6750a80
2020-08-06 20:01:37 +09:00
Hermet Park
cfa17c6df6 svg_engine: fix infinit loop dead in stroke rendering.
here logic was wrongly introducedd, we fix the condition check properly.

Change-Id: I97f18f68290c61096f4e7fe54bd6f6fde51e175b
2020-07-07 11:26:28 +09:00
Hermet Park
5c988d01a5 sw_engine: implement linear gradient feature
also added testLinearGradient

Change-Id: I9cce74b9fc40c4ebd978939ee50955e44e7f44f2
2020-06-13 12:09:39 +09:00
Hermet Park
9aa2566b45 sw_engine: support stroke dash feature
Change-Id: Ibed8bcb6a07952a059bb9a7355f7c43db97aa672
2020-06-06 12:21:30 +09:00
Hermet Park
8614a2efee sw_engine: fix stroke join round result.
a trivial reversed value was returned that
brought the inverted arc drawing...

Change-Id: I928f05b3400772a367d1653496d385354032cbad
2020-06-02 20:25:54 +09:00
Hermet Park
1686af7643 sw_engine: implement stroke rle part
Current stroke fails to merged shapes case...

you can test with testStroke example

Change-Id: I488af728949cba1d01b88723eb1dc4c49bac6c9b
2020-06-02 18:46:43 +09:00
Hermet Park
41dbd9774a sw_engine: implement stroke cubicto, arcto, lineto
Change-Id: I59e95b1031ebfaf54e966cab334e045613ca3830
2020-06-01 19:20:29 +09:00