| @@ -152,6 +152,12 @@ AffineTransform AffineTransform::scaled (const float factorX, const float factor | |||||
| factorY * mat10, factorY * mat11, factorY * mat12); | factorY * mat10, factorY * mat11, factorY * mat12); | ||||
| } | } | ||||
| AffineTransform AffineTransform::scaled (const float factor) const noexcept | |||||
| { | |||||
| return AffineTransform (factor * mat00, factor * mat01, factor * mat02, | |||||
| factor * mat10, factor * mat11, factor * mat12); | |||||
| } | |||||
| AffineTransform AffineTransform::scale (const float factorX, const float factorY) noexcept | AffineTransform AffineTransform::scale (const float factorX, const float factorY) noexcept | ||||
| { | { | ||||
| return AffineTransform (factorX, 0, 0, 0, factorY, 0); | return AffineTransform (factorX, 0, 0, 0, factorY, 0); | ||||
| @@ -165,6 +165,11 @@ public: | |||||
| AffineTransform scaled (float factorX, | AffineTransform scaled (float factorX, | ||||
| float factorY) const noexcept; | float factorY) const noexcept; | ||||
| /** Returns a transform which is the same as this one followed by a re-scaling. | |||||
| The scaling is centred around the origin (0, 0). | |||||
| */ | |||||
| AffineTransform scaled (float factor) const noexcept; | |||||
| /** Returns a transform which is the same as this one followed by a re-scaling. | /** Returns a transform which is the same as this one followed by a re-scaling. | ||||
| The scaling is centred around the origin provided. | The scaling is centred around the origin provided. | ||||
| */ | */ | ||||
| @@ -304,9 +304,10 @@ public: | |||||
| template <typename FloatType> | template <typename FloatType> | ||||
| Rectangle operator*= (FloatType scaleFactor) noexcept | Rectangle operator*= (FloatType scaleFactor) noexcept | ||||
| { | { | ||||
| pos *= scaleFactor; | |||||
| w = (ValueType) (w * scaleFactor); | |||||
| h = (ValueType) (h * scaleFactor); | |||||
| Rectangle<FloatType> (pos.x * scaleFactor, | |||||
| pos.y * scaleFactor, | |||||
| w * scaleFactor, | |||||
| h * scaleFactor).copyWithRounding (*this); | |||||
| return *this; | return *this; | ||||
| } | } | ||||