1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Tidying: Remove unused code

This commit is contained in:
attila 2025-08-15 18:14:41 +02:00 committed by Attila Szarvas
parent 35fe3ac714
commit ad28684b10

View file

@ -449,8 +449,7 @@ public:
{ {
noTransforms = 0, noTransforms = 0,
applyWorldTransform = 1, applyWorldTransform = 1,
applyInverseWorldTransform = 2, applyFillTypeTransform = 2,
applyFillTypeTransform = 4,
applyWorldAndFillTypeTransforms = applyFillTypeTransform | applyWorldTransform applyWorldAndFillTypeTransforms = applyFillTypeTransform | applyWorldTransform
}; };
@ -462,38 +461,30 @@ public:
if (! fillType.isGradient() && ! fillType.isTiledImage()) if (! fillType.isGradient() && ! fillType.isTiledImage())
return currentBrush; return currentBrush;
Point<float> translation{};
AffineTransform transform{}; AffineTransform transform{};
if ((flags & BrushTransformFlags::applyWorldTransform) != 0)
transform = currentTransform.getTransform();
if ((flags & BrushTransformFlags::applyFillTypeTransform) != 0)
transform = fillType.transform.followedBy (transform);
if (fillType.isGradient()) if (fillType.isGradient())
{ {
if ((flags & BrushTransformFlags::applyWorldTransform) != 0) auto p1 = fillType.gradient->point1;
{ auto p2 = fillType.gradient->point2;
if (currentTransform.isOnlyTranslated && fillType.transform.isOnlyTranslation())
translation = currentTransform.offset.toFloat();
else
transform = currentTransform.getTransform();
}
if ((flags & BrushTransformFlags::applyFillTypeTransform) != 0) if (transform.isOnlyTranslation())
{ {
if (fillType.transform.isOnlyTranslation()) Point<float> translation { transform.getTranslationX(), transform.getTranslationY() };
translation += Point (fillType.transform.getTranslationX(), fillType.transform.getTranslationY()); p1 += translation;
else p2 += translation;
transform = fillType.transform.followedBy (transform);
} }
else
if ((flags & BrushTransformFlags::applyInverseWorldTransform) != 0)
{ {
if (currentTransform.isOnlyTranslated) currentBrush->SetTransform (D2DUtilities::transformToMatrix (transform));
translation -= currentTransform.offset.toFloat();
else
transform = transform.followedBy (currentTransform.getTransform().inverted());
} }
const auto p1 = fillType.gradient->point1 + translation;
const auto p2 = fillType.gradient->point2 + translation;
if (fillType.gradient->isRadial) if (fillType.gradient->isRadial)
{ {
const auto radius = p2.getDistanceFrom (p1); const auto radius = p2.getDistanceFrom (p1);
@ -507,19 +498,11 @@ public:
linearGradient->SetEndPoint ({ p2.x, p2.y }); linearGradient->SetEndPoint ({ p2.x, p2.y });
} }
} }
else if (fillType.isTiledImage()) else
{ {
if ((flags & BrushTransformFlags::applyWorldTransform) != 0) currentBrush->SetTransform (D2DUtilities::transformToMatrix (transform));
transform = currentTransform.getTransform();
if ((flags & BrushTransformFlags::applyFillTypeTransform) != 0)
transform = fillType.transform.followedBy (transform);
if ((flags & BrushTransformFlags::applyInverseWorldTransform) != 0)
transform = transform.followedBy (currentTransform.getTransform().inverted());
} }
currentBrush->SetTransform (D2DUtilities::transformToMatrix (transform));
currentBrush->SetOpacity (fillType.getOpacity()); currentBrush->SetOpacity (fillType.getOpacity());
return currentBrush; return currentBrush;