mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
sw_engine: gradient transformation combined with the shape transformation
The gradient transformation has to be included in the last step of gradient preparation (and combined with a shape transformation).
This commit is contained in:
parent
ae3d1e1b80
commit
07c42cb32d
1 changed files with 12 additions and 2 deletions
|
@ -155,9 +155,19 @@ bool _prepareRadial(SwFill* fill, const RadialGradient* radial, const Matrix* tr
|
||||||
fill->radial.shiftY = -cy;
|
fill->radial.shiftY = -cy;
|
||||||
fill->radial.a = radius;
|
fill->radial.a = radius;
|
||||||
|
|
||||||
if (transform) {
|
auto gradTransform = radial->transform();
|
||||||
|
bool isTransformation = !mathIdentity(&gradTransform);
|
||||||
|
|
||||||
|
if (isTransformation) {
|
||||||
|
if (transform) mathMultiply(transform, &gradTransform);
|
||||||
|
} else if (transform) {
|
||||||
|
gradTransform = *transform;
|
||||||
|
isTransformation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isTransformation) {
|
||||||
Matrix invTransform;
|
Matrix invTransform;
|
||||||
if (!mathInverse(transform, &invTransform)) return false;
|
if (!mathInverse(&gradTransform, &invTransform)) return false;
|
||||||
|
|
||||||
fill->radial.a11 = invTransform.e11 * invR;
|
fill->radial.a11 = invTransform.e11 * invR;
|
||||||
fill->radial.a12 = invTransform.e12 * invR;
|
fill->radial.a12 = invTransform.e12 * invR;
|
||||||
|
|
Loading…
Add table
Reference in a new issue