mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Replaced some uses of AffineTransform::identity with a default-constructed object
This commit is contained in:
parent
21d42f346f
commit
edec7b34b2
22 changed files with 55 additions and 49 deletions
|
|
@ -208,7 +208,7 @@ public:
|
|||
pathSize * 0.5f,
|
||||
clipPathAngle.getValue());
|
||||
|
||||
g.reduceClipRegion (p, AffineTransform::identity);
|
||||
g.reduceClipRegion (p, AffineTransform());
|
||||
}
|
||||
|
||||
void clipToImage (Graphics& g)
|
||||
|
|
@ -384,7 +384,7 @@ public:
|
|||
|
||||
PathStrokeType stroke (0.5f + 10.0f * thickness.getValue());
|
||||
g.setColour (Colours::purple.withAlpha (getAlpha()));
|
||||
g.strokePath (p, stroke, AffineTransform::identity);
|
||||
g.strokePath (p, stroke, AffineTransform());
|
||||
}
|
||||
|
||||
SlowerBouncingNumber points[2 + 4 * 8], thickness;
|
||||
|
|
|
|||
|
|
@ -757,7 +757,7 @@ public:
|
|||
-arrowL, -arrowW,
|
||||
arrowL, 0.0f);
|
||||
|
||||
arrow.applyTransform (AffineTransform::identity
|
||||
arrow.applyTransform (AffineTransform()
|
||||
.rotated (float_Pi * 0.5f - (float) atan2 (x2 - x1, y2 - y1))
|
||||
.translated ((x1 + x2) * 0.5f,
|
||||
(y1 + y2) * 0.5f));
|
||||
|
|
|
|||
|
|
@ -394,9 +394,15 @@ void Graphics::fillAll (Colour colourToUse) const
|
|||
|
||||
|
||||
//==============================================================================
|
||||
void Graphics::fillPath (const Path& path) const
|
||||
{
|
||||
if (! (context.isClipEmpty() || path.isEmpty()))
|
||||
context.fillPath (path, AffineTransform());
|
||||
}
|
||||
|
||||
void Graphics::fillPath (const Path& path, const AffineTransform& transform) const
|
||||
{
|
||||
if ((! context.isClipEmpty()) && ! path.isEmpty())
|
||||
if (! (context.isClipEmpty() || path.isEmpty()))
|
||||
context.fillPath (path, transform);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -436,13 +436,15 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Fills a path using the currently selected colour or brush. */
|
||||
void fillPath (const Path& path,
|
||||
const AffineTransform& transform = AffineTransform::identity) const;
|
||||
void fillPath (const Path& path) const;
|
||||
|
||||
/** Fills a path using the currently selected colour or brush, and adds a transform. */
|
||||
void fillPath (const Path& path, const AffineTransform& transform) const;
|
||||
|
||||
/** Draws a path's outline using the currently selected colour or brush. */
|
||||
void strokePath (const Path& path,
|
||||
const PathStrokeType& strokeType,
|
||||
const AffineTransform& transform = AffineTransform::identity) const;
|
||||
const AffineTransform& transform = AffineTransform()) const;
|
||||
|
||||
/** Draws a line with an arrowhead at its end.
|
||||
|
||||
|
|
@ -607,7 +609,7 @@ public:
|
|||
@returns true if the resulting clipping region is non-zero in size
|
||||
@see reduceClipRegion
|
||||
*/
|
||||
bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform::identity);
|
||||
bool reduceClipRegion (const Path& path, const AffineTransform& transform = AffineTransform());
|
||||
|
||||
/** Intersects the current clipping region with an image's alpha-channel.
|
||||
|
||||
|
|
|
|||
|
|
@ -355,13 +355,13 @@ void LowLevelGraphicsPostScriptRenderer::fillRect (const Rectangle<float>& r)
|
|||
{
|
||||
Path p;
|
||||
p.addRectangle (r);
|
||||
fillPath (p, AffineTransform::identity);
|
||||
fillPath (p, AffineTransform());
|
||||
}
|
||||
}
|
||||
|
||||
void LowLevelGraphicsPostScriptRenderer::fillRectList (const RectangleList<float>& list)
|
||||
{
|
||||
fillPath (list.toPath(), AffineTransform::identity);
|
||||
fillPath (list.toPath(), AffineTransform());
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -510,7 +510,7 @@ void LowLevelGraphicsPostScriptRenderer::drawLine (const Line <float>& line)
|
|||
{
|
||||
Path p;
|
||||
p.addLineSegment (line, 1.0f);
|
||||
fillPath (p, AffineTransform::identity);
|
||||
fillPath (p, AffineTransform());
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -219,11 +219,9 @@ AffineTransform AffineTransform::inverted() const noexcept
|
|||
return AffineTransform (dst00, dst01, -mat02 * dst00 - mat12 * dst01,
|
||||
dst10, dst11, -mat02 * dst10 - mat12 * dst11);
|
||||
}
|
||||
else
|
||||
{
|
||||
// singularity..
|
||||
return *this;
|
||||
}
|
||||
|
||||
// singularity..
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool AffineTransform::isSingularity() const noexcept
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ public:
|
|||
transformations to.
|
||||
|
||||
e.g. @code
|
||||
AffineTransform myTransform = AffineTransform::identity.rotated (.5f)
|
||||
.scaled (2.0f);
|
||||
AffineTransform myTransform = AffineTransform().rotated (.5f)
|
||||
.scaled (2.0f);
|
||||
@endcode
|
||||
*/
|
||||
static const AffineTransform identity;
|
||||
|
|
|
|||
|
|
@ -981,7 +981,7 @@ AffineTransform Path::getTransformToScaleToFit (const float x, const float y,
|
|||
if (preserveProportions)
|
||||
{
|
||||
if (w <= 0 || h <= 0 || boundsRect.isEmpty())
|
||||
return AffineTransform::identity;
|
||||
return AffineTransform();
|
||||
|
||||
float newW, newH;
|
||||
const float srcRatio = boundsRect.getHeight() / boundsRect.getWidth();
|
||||
|
|
@ -1030,7 +1030,7 @@ bool Path::contains (const float x, const float y, const float tolerance) const
|
|||
|| y <= bounds.pathYMin || y >= bounds.pathYMax)
|
||||
return false;
|
||||
|
||||
PathFlatteningIterator i (*this, AffineTransform::identity, tolerance);
|
||||
PathFlatteningIterator i (*this, AffineTransform(), tolerance);
|
||||
|
||||
int positiveCrossings = 0;
|
||||
int negativeCrossings = 0;
|
||||
|
|
@ -1062,7 +1062,7 @@ bool Path::contains (const Point<float> point, const float tolerance) const
|
|||
|
||||
bool Path::intersectsLine (const Line<float>& line, const float tolerance)
|
||||
{
|
||||
PathFlatteningIterator i (*this, AffineTransform::identity, tolerance);
|
||||
PathFlatteningIterator i (*this, AffineTransform(), tolerance);
|
||||
Point<float> intersection;
|
||||
|
||||
while (i.next())
|
||||
|
|
@ -1085,7 +1085,7 @@ Line<float> Path::getClippedLine (const Line<float>& line, const bool keepSectio
|
|||
}
|
||||
else
|
||||
{
|
||||
PathFlatteningIterator i (*this, AffineTransform::identity);
|
||||
PathFlatteningIterator i (*this, AffineTransform());
|
||||
Point<float> intersection;
|
||||
|
||||
while (i.next())
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public:
|
|||
/** Returns the length of the path.
|
||||
@see getPointAlongPath
|
||||
*/
|
||||
float getLength (const AffineTransform& transform = AffineTransform::identity) const;
|
||||
float getLength (const AffineTransform& transform = AffineTransform()) const;
|
||||
|
||||
/** Returns a point that is the specified distance along the path.
|
||||
If the distance is greater than the total length of the path, this will return the
|
||||
|
|
@ -166,7 +166,7 @@ public:
|
|||
@see getLength
|
||||
*/
|
||||
Point<float> getPointAlongPath (float distanceFromStart,
|
||||
const AffineTransform& transform = AffineTransform::identity) const;
|
||||
const AffineTransform& transform = AffineTransform()) const;
|
||||
|
||||
/** Finds the point along the path which is nearest to a given position.
|
||||
This sets pointOnPath to the nearest point, and returns the distance of this point from the start
|
||||
|
|
@ -174,7 +174,7 @@ public:
|
|||
*/
|
||||
float getNearestPoint (const Point<float> targetPoint,
|
||||
Point<float>& pointOnPath,
|
||||
const AffineTransform& transform = AffineTransform::identity) const;
|
||||
const AffineTransform& transform = AffineTransform()) const;
|
||||
|
||||
//==============================================================================
|
||||
/** Removes all lines and curves, resetting the path completely. */
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public:
|
|||
less lines, so can be generated faster, but will be less smooth.
|
||||
*/
|
||||
PathFlatteningIterator (const Path& path,
|
||||
const AffineTransform& transform = AffineTransform::identity,
|
||||
const AffineTransform& transform = AffineTransform(),
|
||||
float tolerance = defaultTolerance);
|
||||
|
||||
/** Destructor. */
|
||||
|
|
|
|||
|
|
@ -695,7 +695,7 @@ void PathStrokeType::createDashedStroke (Path& destPath,
|
|||
if (isSolid && ! first)
|
||||
newDestPath.lineTo (it.x2, it.y2);
|
||||
|
||||
createStrokedPath (destPath, newDestPath, AffineTransform::identity, extraAccuracy);
|
||||
createStrokedPath (destPath, newDestPath, AffineTransform(), extraAccuracy);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public:
|
|||
*/
|
||||
void createStrokedPath (Path& destPath,
|
||||
const Path& sourcePath,
|
||||
const AffineTransform& transform = AffineTransform::identity,
|
||||
const AffineTransform& transform = AffineTransform(),
|
||||
float extraAccuracy = 1.0f) const;
|
||||
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ public:
|
|||
const Path& sourcePath,
|
||||
const float* dashLengths,
|
||||
int numDashLengths,
|
||||
const AffineTransform& transform = AffineTransform::identity,
|
||||
const AffineTransform& transform = AffineTransform(),
|
||||
float extraAccuracy = 1.0f) const;
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -163,7 +163,7 @@ public:
|
|||
const Path& sourcePath,
|
||||
float arrowheadStartWidth, float arrowheadStartLength,
|
||||
float arrowheadEndWidth, float arrowheadEndLength,
|
||||
const AffineTransform& transform = AffineTransform::identity,
|
||||
const AffineTransform& transform = AffineTransform(),
|
||||
float extraAccuracy = 1.0f) const;
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -2044,7 +2044,7 @@ public:
|
|||
{
|
||||
Path p;
|
||||
p.addRectangle (r);
|
||||
clipToPath (p, AffineTransform::identity);
|
||||
clipToPath (p, AffineTransform());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2074,7 +2074,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
clipToPath (r.toPath(), AffineTransform::identity);
|
||||
clipToPath (r.toPath(), AffineTransform());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2112,7 +2112,7 @@ public:
|
|||
p.applyTransform (transform.complexTransform);
|
||||
p.addRectangle (clip->getClipBounds().toFloat());
|
||||
p.setUsingNonZeroWinding (false);
|
||||
clip = clip->clipToPath (p, AffineTransform::identity);
|
||||
clip = clip->clipToPath (p, AffineTransform());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2205,7 +2205,7 @@ public:
|
|||
{
|
||||
Path p;
|
||||
p.addRectangle (r);
|
||||
fillPath (p, AffineTransform::identity);
|
||||
fillPath (p, AffineTransform());
|
||||
}
|
||||
|
||||
void fillRect (const Rectangle<int>& r, const bool replaceContents)
|
||||
|
|
@ -2258,7 +2258,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
fillPath (list.toPath(), AffineTransform::identity);
|
||||
fillPath (list.toPath(), AffineTransform());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2298,7 +2298,7 @@ public:
|
|||
{
|
||||
Path p;
|
||||
p.addLineSegment (line, 1.0f);
|
||||
fillPath (p, AffineTransform::identity);
|
||||
fillPath (p, AffineTransform());
|
||||
}
|
||||
|
||||
void drawImage (const Image& sourceImage, const AffineTransform& trans)
|
||||
|
|
@ -2394,7 +2394,7 @@ public:
|
|||
// If our translation doesn't involve any distortion, we can speed it up..
|
||||
g2.point1.applyTransform (t);
|
||||
g2.point2.applyTransform (t);
|
||||
t = AffineTransform::identity;
|
||||
t = AffineTransform();
|
||||
}
|
||||
|
||||
shapeToFill->fillAllWithGradient (getThis(), g2, t, isIdentity);
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ void CoreGraphicsContext::drawLine (const Line<float>& line)
|
|||
{
|
||||
Path p;
|
||||
p.addLineSegment (line, 1.0f);
|
||||
fillPath (p, AffineTransform::identity);
|
||||
fillPath (p, AffineTransform());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -571,7 +571,7 @@ public:
|
|||
|
||||
ascent = ctAscent / ctTotalHeight;
|
||||
unitsToHeightScaleFactor = 1.0f / ctTotalHeight;
|
||||
pathTransform = AffineTransform::identity.scale (unitsToHeightScaleFactor);
|
||||
pathTransform = AffineTransform::scale (unitsToHeightScaleFactor);
|
||||
|
||||
fontHeightToPointsFactor = referenceFontSize / ctTotalHeight;
|
||||
|
||||
|
|
@ -847,7 +847,7 @@ public:
|
|||
|
||||
fontHeightToPointsFactor = referenceFontSize / (nsFontAscent + nsFontDescent);
|
||||
|
||||
pathTransform = AffineTransform::identity.scale (unitsToHeightScaleFactor);
|
||||
pathTransform = AffineTransform::scale (unitsToHeightScaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ void RectanglePlacement::applyTo (double& x, double& y, double& w, double& h,
|
|||
AffineTransform RectanglePlacement::getTransformToFit (const Rectangle<float>& source, const Rectangle<float>& destination) const noexcept
|
||||
{
|
||||
if (source.isEmpty())
|
||||
return AffineTransform::identity;
|
||||
return AffineTransform();
|
||||
|
||||
float newX = destination.getX();
|
||||
float newY = destination.getY();
|
||||
|
|
|
|||
|
|
@ -1359,7 +1359,7 @@ bool Component::isTransformed() const noexcept
|
|||
|
||||
AffineTransform Component::getTransform() const
|
||||
{
|
||||
return affineTransform != nullptr ? *affineTransform : AffineTransform::identity;
|
||||
return affineTransform != nullptr ? *affineTransform : AffineTransform();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -574,7 +574,7 @@ public:
|
|||
Currently, transforms are not supported for desktop windows, so the transform will be ignored if you
|
||||
put a component on the desktop.
|
||||
|
||||
To remove a component's transform, simply pass AffineTransform::identity as the parameter to this method.
|
||||
To remove a component's transform, simply pass AffineTransform() as the parameter to this method.
|
||||
*/
|
||||
void setTransform (const AffineTransform& transform);
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public:
|
|||
@see drawWithin
|
||||
*/
|
||||
void draw (Graphics& g, float opacity,
|
||||
const AffineTransform& transform = AffineTransform::identity) const;
|
||||
const AffineTransform& transform = AffineTransform()) const;
|
||||
|
||||
/** Renders the Drawable at a given offset within the Graphics context.
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ void DrawableComposite::recalculateCoordinates (Expression::Scope* scope)
|
|||
content.getX(), content.getBottom(), resolved[2].x, resolved[2].y));
|
||||
|
||||
if (t.isSingularity())
|
||||
t = AffineTransform::identity;
|
||||
t = AffineTransform();
|
||||
|
||||
setTransform (t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ void DrawableImage::recalculateCoordinates (Expression::Scope* scope)
|
|||
bl.x, bl.y));
|
||||
|
||||
if (t.isSingularity())
|
||||
t = AffineTransform::identity;
|
||||
t = AffineTransform();
|
||||
|
||||
setTransform (t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ void DrawableShape::pathChanged()
|
|||
void DrawableShape::strokeChanged()
|
||||
{
|
||||
strokePath.clear();
|
||||
strokeType.createStrokedPath (strokePath, path, AffineTransform::identity, 4.0f);
|
||||
strokeType.createStrokedPath (strokePath, path, AffineTransform(), 4.0f);
|
||||
|
||||
setBoundsToEnclose (getDrawableBounds());
|
||||
repaint();
|
||||
|
|
@ -224,7 +224,7 @@ DrawableShape::RelativeFillType::RelativeFillType (const FillType& fill_)
|
|||
gradientPoint3 = Point<float> (g.point1.x + g.point2.y - g.point1.y,
|
||||
g.point1.y + g.point1.x - g.point2.x)
|
||||
.transformedBy (fill.transform);
|
||||
fill.transform = AffineTransform::identity;
|
||||
fill.transform = AffineTransform();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -375,7 +375,7 @@ bool DrawableShape::RelativeFillType::readFrom (const ValueTree& v, ComponentBui
|
|||
if (imageProvider != nullptr)
|
||||
im = imageProvider->getImageForIdentifier (v [FillAndStrokeState::imageId]);
|
||||
|
||||
fill.setTiledImage (im, AffineTransform::identity);
|
||||
fill.setTiledImage (im, AffineTransform());
|
||||
fill.setOpacity ((float) v.getProperty (FillAndStrokeState::imageOpacity, 1.0f));
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue