Commit graph

61 commits

Author SHA1 Message Date
Mira Grudzinska
a13561e9c5 sw_engine: adding a check before stroke fill dereference
The crash was observed for empty shapes.
2021-04-15 13:33:58 +09:00
Mira Grudzinska
30ee03002b sw_engine: fixing stroke gradient
Instead of checking the stroke's fill, the shape's fill was checked.
As a result the improper rastering function was called (or none).
2021-04-09 13:18:52 +02:00
Hermet Park
818d24fc70 sw_engine: fix GradientStroke crash
++ strict null check.
2021-04-08 14:15:23 +09:00
Mira Grudzinska
fcad63ec1f sw_engine raster: adding antialiasing to the gradient rastering functions
The gradient rastering functions with composition did not take
antialiasing into account. The missing part has been added.
2021-04-08 13:54:38 +09:00
Mira Grudzinska
9d7a264610 sw_engine raster: refactoring the gradient rastering functions
The gradient rastering functions have been splitted into translucent
and opaque.
2021-04-08 13:54:38 +09:00
Mira Grudzinska
6b5db72f67 sw_engine: rastering the opaque radial gradient with masking
In the radial gradient rastering functions, the part supporting
the (inverse) masking was added.
2021-04-08 13:54:38 +09:00
Mira Grudzinska
8284b3fdfc sw_engine: removed unnecessary function parameter
In the fillFetchLinear function the offset parameter was removed.
The destination address may be shifted directly in the dst parameter,
it doesn't need to be passed separately.
2021-04-08 13:54:38 +09:00
Hermet Park
9a40b64261 sw_engine raster: ++ precise alpha multiplying
previously alpha multiplying operation doesn't have perfect precision,
could loss 1 pixel since it divides 255 values by 256.

This improved operation comply with both precision & performance.
2021-04-05 12:04:25 +02:00
Mira Grudzinska
44f10698ed sw_engine: unnecessary memory allocation and variables has been removed 2021-04-01 21:19:14 +09:00
Mira Grudzinska
fe32ca8de7 sw_engine: fixing linear gradient rastering for shapes with composition
Masking and Inverse masking are for now rastered properly only for the linear
gradients without the opacity.
2021-04-01 11:51:08 +09:00
Patryk Kaczmarek
cd6fb4f483 gradients: paint linerar gradients properly with mask composition method
@Issues: 243

Change-Id: Ie26a0b903af94a46683348e3fb7d8b554576997c
2021-03-31 20:38:16 +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
1a7d41ce71 updated copyright 2021-03-23 14:31:58 +09:00
Mira Grudzinska
b5bc73849c sw_engine raster: functions optimization in the image block
The alpha value calculation pulled out outside the inner loop
to reduce the number of unnecessary operations.
Added local variables to reduce the number of costly
multiplications performed in a loop.
2021-03-09 19:47:50 +09:00
Hermet Park
197879f2ef fixed all wasm build breaks. 2021-02-23 10:47:46 +09:00
Mira Grudzinska
5e1d3772ca sw_engine raster: fixing rasterization of an image with InvMask
In case of the image rasterization with an inverse mask the opacity
was omitted and the alpha value instead of the inverse alpha value was used.
2021-02-22 13:02:04 +09:00
Hermet Park
028e1fa251 sw_engine: enhance log message.
more informational log is better.
2021-02-22 12:53:56 +09:00
Mira Grudzinska
d86032df36
sw_engine: adding a gradient as a stroke feature
* sw_engine: adding a gradient as a stroke feature

Similarly as a shape may have a gradient fill so can the stroke.

* Capi: adding APIs for a gradient stroke

Co-authored-by: Hermet Park <hermetpark@gmail.com>
2021-02-19 17:16:10 +09:00
JunsuChoi
415fca577e common: TVG_UNUSED marking on unused parameter 2021-02-19 16:51:50 +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
Mira Grudzinska
6925f6c272 sw_engine raster: checking zero division while inverting the transform matrix
In case the user has provided the transformation matrix, it is possible that
the inverse matrix does not exist.
2021-02-09 09:26:37 +09:00
Mira Grudzinska
46f8945028 sw_engine raster: adding rastering functions for image without transformation
Added rastering functions for the image (transparent and not) for the fast
track option - identity transform.
2021-02-09 09:21:53 +09:00
Mira Grudzinska
307f3698a8 sw_engine raster: removing unnecessary logical 'and' operation
Shifting the 32-bit number by 24 bits leaves only 8 bits,
so there is no need to mask them with 0xFF.
2021-02-03 11:25:19 +09:00
Patryk Kaczmarek
905fd46ccf sw_engine composition: invert alpha masking
composition invert alpha masking

@Examples: added InvMasking

@Issues: 31

Change-Id: I2ee9d428d5749240ddf2e6adbb7677dccbe1926f
2021-02-02 11:47:30 +09:00
Hermet Park
3a156b6307 sw_engine composition: enhance image masking
composition alpha masking supports scene/paints targets.

@Examples: Masking

@Issues: 31
2021-01-10 23:22:01 +09:00
Hermet Park
581e33b954 sw_engine: optimize raster image.
added a routine that draw non-transformed translucent image.
composition images will use this routine to draw faster.

Also added optimization point comments in raster image.
2021-01-10 20:11:37 +09:00
Hermet Park
736d6ee4ef
common sw_engine: revise the masking implementation.
We re-implement the masking feature with image composition method.

This patch is working only for single shape but settle up coming extensions.
2021-01-04 00:46:59 +09:00
Hermet Park
7d9023ac5c common sw_engine: code refactoring
Renamed internal interfaces.

We need both blender & compositor interfaces.

Renamed SwCompositor -> SwBlender which is for pixel joining methods.

Added (SwCompositor, Compositor) which is designed for compositing images.
2020-12-25 20:54:56 +09:00
Hermet Park
b7312a11d4 sw_engine raster: fix incorrect condition check.
These values won't be less than zero since they are unsigned types.
2020-12-22 10:46:51 +09:00
Hermet Park
64d3897816
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
2020-12-14 12:29:37 +09:00
Hermet Park
ceb14e73a8 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.
2020-12-03 18:59:42 +09:00
Hermet Park
1743db705b
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.
2020-12-02 16:49:53 +09:00
JunsuChoi
d8d754e969 sw_engine Raster: Add null check for transform
If transform is null, identify matrix is used.
2020-11-30 15:32:30 +09:00
JunsuChoi
e00f948705
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;
2020-11-23 18:12:36 +09:00
Hermet Park
740c59debd sw_engine: code refactoring.
clean code for compaction.
2020-10-07 10:36:59 +09:00
Mateusz Palkowski
3314df89ae gradient: added check for gradient start and end set for 0 2020-10-07 10:28:41 +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
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
06d8d06993 sw_engine: replace rgba8888 with abgr8888
Actually Dali rendering system requires abgr8888.

We could add more colorspaces if it's necessary.

Change-Id: Ia42a6575d1313629e55efc3077e302992c47b6c0
2020-08-19 18:39:23 +09:00
Hermet Park
a5beca7369 sw_engine: code refactoring
introduce compositor table for runtime colorspace switching.

Change-Id: If179d1e1625f995e114d66cf1bf13742c54ed4f7
2020-08-18 20:27:23 +09:00
Hermet Park
f4d1065d52 sw_engine: convert colorspace ARGB -> RGBA in default.
We can use RGBA colorspace rather ARGB for pixel data.
This would be better for many rendering system,
since it's more widely preferred than ARGB including opengl.

Change-Id: Ibbfe6a511d77bf0ef30ce261995467c11164d306
2020-08-15 18:22:43 +09:00
Hermet Park
7289116227 remove std async usage.
we can't control any threads count that could drop the performance.

remove async() and will come back with fine-tuned threading-pool.

Change-Id: I17c39792234acfce6db334abc0ce12da23978a9a
2020-08-14 17:41:44 +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
9f6b5eb59e common: changed premultiplied color policy.
Some user have no idea of premultiplied alpha concept,
We suggest more user-friendly interfaces so that they don't confuse it.

Now, this pre-multipying is acommplished by backend engines.

Change-Id: Ifd84d56361cb56a8b98240bbd16690accf370bad
2020-08-06 13:54:51 +09:00
Hermet Park
9e1ba8d2c0 sw_engine: introduce avx simd instruction
avx is the cutting edge method for intel & amd cpus simd instruction.
We are going to support this feature for the desktop environment (instead of sse)

You can turn on this with configuration something like this:

$meson . build -Dvectors=avx

Current patch supports only for raster solid color

Change-Id: I068ba30a1f63d480415e2762f8021fc8d6d28a39
2020-07-11 20:58:09 +09:00
Hermet Park
322174d778 sw_engine: optimize othogonal rectangle drawing.
if the rectangle is not transformed, we don't need to use rle method.
we can directly raster pixels onto the bounding box.

Change-Id: I4e8b57149c0bcd78124d09388bf5115093a43bee
2020-07-01 15:53:47 +09:00
Hermet Park
86300c5fc0 sw_engine: optimize raster.
memset() is more than 10x faster than manual loop.

Thus we replace it to manipulate buffer pixels.

Change-Id: If0f255578f7d49ff6704c4f15e2eefe435cc3c15
2020-06-23 16:55:06 +09:00
Hermet Park
7366e8949b sw_engine: implement gradial gradient feature
also added testRadialGradient

Change-Id: If4a278cb4667c38c7842ad30edf5aa2fdd56fff7
2020-06-15 17:43:52 +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