Commit graph

650 commits

Author SHA1 Message Date
JunsuChoi
f590571e3a svg_loader SvgLoader: Fix copy conditions for stop of gradient
When getting a linked stop list, if there is no existing stop list
in current gradient, it is copied.
2021-03-04 18:43:58 +09:00
Mira Grudzinska
a173b16ed5 svgloader: fixing linear gradient transformation
Gradient stop points were incorrectly transformed when building
the scene in the SVG loader.
2021-03-03 19:48:26 -08:00
Hermet Park
cb425fa4bb capi: fix incorrect composite api.
Api prototype is completely wrong, now it's corrected.
2021-03-04 11:33:24 +09:00
Mira Grudzinska
a72be6159d svgloader: fixing SVG image display when viewBox size is not given
When viewBox is not given its dimensions should be determined
by the height and width parameters
2021-03-03 18:02:36 -08:00
Mira Grudzinska
07e6c476a8 sw_engine fill: fixing the infinite loop condition
Fixed in the fillFetchLinear() function.
2021-03-03 17:46:33 +09:00
Mira Grudzinska
d03db583e5 svgloader: fillRule value passed to the shape
The value was loadeed but not set to the shape.
2021-03-02 18:05:54 -08:00
Mira Grudzinska
692e100f9a canvas: replacement of the bitwise OR operator with the logical one
Bitwise logical operators do not perform short-circuiting.
2021-03-03 10:54:27 +09:00
Hermet Park
d522c9d45e
sw_engine fill: fix wrong gradient transformation
There transformation logic was not identical between shape & gradient

gradient transform was applied into center of gradient world,
while shape wasn't. So... we correct gradient transform metric to shape like.

@Issues: 255
2021-03-03 10:53:32 +09:00
Juyeong Lee
7147ebf21a Fix typo in CONTRIBUTING.md 2021-02-26 18:14:17 +09:00
Hermet Park
e64ff980b0 examples images: correct file change mode.
For consistency, thorvg keeps file chmod => 664.
2021-02-25 19:14:23 +09:00
Hermet Park
6cd587ba5f scene: fix a composition regression bug.
Pre-condition is broken when this commit come - b60a773d12

Both condition should be identitcal so that comp logic is perfectly performed.
2021-02-25 18:06:56 +09:00
Hermet Park
8c635e9591
Update CONTRIBUTING.md
fix typo
2021-02-25 12:41:20 +09:00
Hermet Park
a05ddfcd81 updated community guide resource. 2021-02-25 12:39:14 +09:00
Hermet Park
b60a773d12
common: optimize scene composition
Scene could avoid composition if its children is only child (non scene)

This patch bring it conditionally check so as to avoid unnecesary expensive job.

@Issues: 254
2021-02-25 12:38:39 +09:00
Hermet Park
a576c8f4cd
Update CONTRIBUTING.md
updated guideline
2021-02-25 12:35:41 +09:00
Patryk Kaczmarek
03d48159e3 examples: new AnimateMask example and svg images with masks
Change-Id: I609597a5ecb710e9af9939a3028eeef691b66188
2021-02-25 12:24:19 +09:00
Hermet Park
f378105c43
Update CONTRIBUTING.md
++updated
2021-02-25 12:18:47 +09:00
Hermet Park
c0362cb69c sw_engine: fix a composition crash issue.
Added an exceptional handling for out of buffer boundary.
2021-02-24 20:02:10 +09:00
Hermet Park
69ff5a484b canvas: fix crash issue.
When canvas target size is changed, it need to update all retained paints again
so that they cannot redraw onto out of buffer boundary.
2021-02-24 19:58:44 +09:00
Hermet Park
197879f2ef fixed all wasm build breaks. 2021-02-23 10:47:46 +09:00
Michal Szczecinski
d6d65c3bd6
Issue 180 example (#212)
* examples: Added resize_cb to Capi example.

resize_cb in capi example is used to verify crash on reize described
in @180 issue.

* examples capi: Fixed file type from dos to unix.

Use the same code style as it is used in other examples.
2021-02-22 13:30:05 +09:00
Michal Szczecinski
f0ab7f4002 sw common: Fixed crash in rasterRGBA32
Description:
Crash was observed in examples when composite object was used.
It was caused because __m256i object was used on non aligned
memory to 32bit. Algorithm in this function was changed to use
unaligned __m256i_u object. Code was also simplified.
2021-02-22 13:26:41 +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
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
6db7f85ffb common Scene: Fix translucent composition condition
If a scene has another scene as a child and
the number of children is 1, the composition of the child does not work.
Therefore, fix that composition works as long as the number of children is not 0.
2021-02-22 11:00:20 +09:00
Patryk Kaczmarek
795121fa67 SvgLoader: Mask style implementation
Supprot case when style is defined as <mask> attribute.

[Example SVG file]
```html
<svg version="1.1" id="Layer_1" viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve"
  xmlns="http://www.w3.org/2000/svg">
  <defs>
    <mask id="myMask">
      <circle id="maskID" cx="40" cy="40" r="10" fill="white" fill-opacity="1" />
    </mask>
  </defs>
  <rect x="0" y="0" width="64" height="64" style="fill: skyblue; mask=url(#myMask);"/>
</svg>
```

Change-Id: I3b856db85204bf7c503a20e4023417ca79aa930c
2021-02-19 18:23:47 +09:00
JunsuChoi
70e1e7f1c6 sw_engine Renderer: Fix build problem caused by merge conflict. 2021-02-19 17:33:15 +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
Mira Grudzinska
20324dc48e example StrokeGradient
Example showing a gradient usage for a stroke.
2021-02-19 17:14:12 +09:00
JunsuChoi
415fca577e common: TVG_UNUSED marking on unused parameter 2021-02-19 16:51:50 +09:00
JunsuChoi
69f02d803b shape: Refactoring to use initialize list
Member data should be initialized in-class or in a constructor initialization list
2021-02-19 16:51:50 +09:00
JunsuChoi
c819754056 common: Refactoring incorrectly declared loop variable
Loop variables should be declared in the minimal possible scope
thorvg prefers to declare when using local variables.
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
JunsuChoi
3c7adb0a95 common: Functions that can declare const are refactored to use const
Member functions that don't mutate their objects should be declared "const"
2021-02-19 16:51:50 +09:00
Mira Grudzinska
29ca149b4b sw_engine rle: fixing clipping with non overlaping figures
For clip that did not overlap with the plotted source, the whole
source was plotted - the size of the rle data was not updated.
2021-02-19 15:11:20 +09:00
JunsuChoi
2657acc1bc common: Fix ubuntu version in build test
github action started updating to ubuntu20.04 for ubuntu-latest.
So fix Ubuntu version 18.04 as we are not ready enough to test for 20.04 yet.
2021-02-19 14:32:51 +09:00
Mira Grudzinska
f1fd23cf32 common render: removed unnecessary assignments in update() fun
The rotation part of the transformation matrix can be assigned,
it does not have to be multiplied by the identity matrix.
The values of e13 and e23 of the transformation matrix represents the translation,
so they don't need to be taken into account in the rotation part.
2021-02-19 14:11:44 +09:00
JunsuChoi
e5f59b53a4 infra CI: Introduce new build test with github action
This is a build checker using the github action.
When a pull request occurs this action does a basic build,
example build, build with test.
2021-02-19 12:59:35 +09:00
JunsuChoi
c63f961b9c common: Clean up code
- Combine if condition with the same return value.
- Remove empty space
- Remove tab
2021-02-18 14:03:47 +09:00
JunsuChoi
6a4598f706 infra coding_style: Add coding style check bot
Add a bot that checks the coding style using cpplint
and reports the result as a review comment.

This feature refers to the repository where cpplint
and docker settings with github-action.
This action works whenever a PR is created and updated.

In cpplint, only the violation of ThorVG's coding style is reported
as a warning using several options.
whitespace/parens
whitespace/indent
whitespace/end_of_line
whitespace/blank_line

The bot will review all of the contents of all files in the current commit file list,
However, in the future, we will improve Bot to only review the changes.
2021-02-18 14:00:21 +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
e154bfb264 example ClipPath: update
Added example with non-overlaping clip and shape.
2021-02-09 09:10:34 +09:00
Hermet Park
6ff2b781cd
Update CONTRIBUTING.md
updated maintainers.
2021-02-03 11:33:39 +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
Michal Szczecinski
8003c439fe renderer: Fixed RenderUpdate::All flag fields.
All flag should have all bits set to 1.
2021-02-03 11:24:00 +09:00
Michal Szczecinski
ba2bd2383d shape: Fixed reset api.
Added stroke's RLE reset in shape reset function.
2021-02-03 11:23:21 +09:00
Mira Grudzinska
3dfc3c4943 sw_engine renderer: rendering optimization of shapes without strokes
The value of 'a' for shapes without a stroke could hold the fill 'a' value.
Added checking if stroke exists before calling rastering functions.
2021-02-02 11:53:58 +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