mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Minor tidying
This commit is contained in:
parent
794d9d4862
commit
4d0cd69895
3 changed files with 25 additions and 25 deletions
|
|
@ -957,8 +957,8 @@ void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask)
|
|||
bool DynamicLibrary::open (const String& name)
|
||||
{
|
||||
close();
|
||||
handle = dlopen (name.toUTF8(), RTLD_LOCAL | RTLD_NOW);
|
||||
return handle != 0;
|
||||
handle = dlopen (name.isEmpty() ? nullptr : name.toUTF8(), RTLD_LOCAL | RTLD_NOW);
|
||||
return handle != nullptr;
|
||||
}
|
||||
|
||||
void DynamicLibrary::close()
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ public:
|
|||
}
|
||||
|
||||
/** Creates a line from its start and end points. */
|
||||
Line (const Point<ValueType>& startPoint,
|
||||
const Point<ValueType>& endPoint) noexcept
|
||||
Line (const Point<ValueType> startPoint,
|
||||
const Point<ValueType> endPoint) noexcept
|
||||
: start (startPoint),
|
||||
end (endPoint)
|
||||
{
|
||||
|
|
@ -98,10 +98,10 @@ public:
|
|||
inline ValueType getEndY() const noexcept { return end.y; }
|
||||
|
||||
/** Returns the line's start point. */
|
||||
inline const Point<ValueType>& getStart() const noexcept { return start; }
|
||||
inline Point<ValueType> getStart() const noexcept { return start; }
|
||||
|
||||
/** Returns the line's end point. */
|
||||
inline const Point<ValueType>& getEnd() const noexcept { return end; }
|
||||
inline Point<ValueType> getEnd() const noexcept { return end; }
|
||||
|
||||
/** Changes this line's start point */
|
||||
void setStart (ValueType newStartX, ValueType newStartY) noexcept { start.setXY (newStartX, newStartY); }
|
||||
|
|
@ -110,10 +110,10 @@ public:
|
|||
void setEnd (ValueType newEndX, ValueType newEndY) noexcept { end.setXY (newEndX, newEndY); }
|
||||
|
||||
/** Changes this line's start point */
|
||||
void setStart (const Point<ValueType>& newStart) noexcept { start = newStart; }
|
||||
void setStart (const Point<ValueType> newStart) noexcept { start = newStart; }
|
||||
|
||||
/** Changes this line's end point */
|
||||
void setEnd (const Point<ValueType>& newEnd) noexcept { end = newEnd; }
|
||||
void setEnd (const Point<ValueType> newEnd) noexcept { end = newEnd; }
|
||||
|
||||
/** Returns a line that is the same as this one, but with the start and end reversed, */
|
||||
const Line reversed() const noexcept { return Line (end, start); }
|
||||
|
|
@ -250,7 +250,7 @@ public:
|
|||
@returns the point's distance from the line
|
||||
@see getPositionAlongLineOfNearestPoint
|
||||
*/
|
||||
ValueType getDistanceFromPoint (const Point<ValueType>& targetPoint,
|
||||
ValueType getDistanceFromPoint (const Point<ValueType> targetPoint,
|
||||
Point<ValueType>& pointOnLine) const noexcept
|
||||
{
|
||||
const Point<ValueType> delta (end - start);
|
||||
|
|
@ -291,7 +291,7 @@ public:
|
|||
turn this number into a position, use getPointAlongLineProportionally().
|
||||
@see getDistanceFromPoint, getPointAlongLineProportionally
|
||||
*/
|
||||
ValueType findNearestProportionalPositionTo (const Point<ValueType>& point) const noexcept
|
||||
ValueType findNearestProportionalPositionTo (const Point<ValueType> point) const noexcept
|
||||
{
|
||||
const Point<ValueType> delta (end - start);
|
||||
const double length = delta.x * delta.x + delta.y * delta.y;
|
||||
|
|
@ -305,7 +305,7 @@ public:
|
|||
/** Finds the point on this line which is nearest to a given point.
|
||||
@see getDistanceFromPoint, findNearestProportionalPositionTo
|
||||
*/
|
||||
Point<ValueType> findNearestPointTo (const Point<ValueType>& point) const noexcept
|
||||
Point<ValueType> findNearestPointTo (const Point<ValueType> point) const noexcept
|
||||
{
|
||||
return getPointAlongLineProportionally (findNearestProportionalPositionTo (point));
|
||||
}
|
||||
|
|
@ -316,7 +316,7 @@ public:
|
|||
coordinate of this line at the given x (assuming the line extends infinitely
|
||||
in both directions).
|
||||
*/
|
||||
bool isPointAbove (const Point<ValueType>& point) const noexcept
|
||||
bool isPointAbove (const Point<ValueType> point) const noexcept
|
||||
{
|
||||
return start.x != end.x
|
||||
&& point.y < ((end.y - start.y)
|
||||
|
|
@ -349,8 +349,8 @@ private:
|
|||
//==============================================================================
|
||||
Point<ValueType> start, end;
|
||||
|
||||
static bool findIntersection (const Point<ValueType>& p1, const Point<ValueType>& p2,
|
||||
const Point<ValueType>& p3, const Point<ValueType>& p4,
|
||||
static bool findIntersection (const Point<ValueType> p1, const Point<ValueType> p2,
|
||||
const Point<ValueType> p3, const Point<ValueType> p4,
|
||||
Point<ValueType>& intersection) noexcept
|
||||
{
|
||||
if (p2 == p3)
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public:
|
|||
}
|
||||
|
||||
/** Creates a Rectangle from the positions of two opposite corners. */
|
||||
Rectangle (const Point<ValueType>& corner1, const Point<ValueType>& corner2) noexcept
|
||||
Rectangle (const Point<ValueType> corner1, const Point<ValueType> corner2) noexcept
|
||||
: pos (jmin (corner1.x, corner2.x),
|
||||
jmin (corner1.y, corner2.y)),
|
||||
w (corner1.x - corner2.x),
|
||||
|
|
@ -139,16 +139,16 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Returns the rectangle's top-left position as a Point. */
|
||||
inline const Point<ValueType>& getPosition() const noexcept { return pos; }
|
||||
inline Point<ValueType> getPosition() const noexcept { return pos; }
|
||||
|
||||
/** Changes the position of the rectangle's top-left corner (leaving its size unchanged). */
|
||||
inline void setPosition (const Point<ValueType>& newPos) noexcept { pos = newPos; }
|
||||
inline void setPosition (const Point<ValueType> newPos) noexcept { pos = newPos; }
|
||||
|
||||
/** Changes the position of the rectangle's top-left corner (leaving its size unchanged). */
|
||||
inline void setPosition (const ValueType newX, const ValueType newY) noexcept { pos.setXY (newX, newY); }
|
||||
|
||||
/** Returns the rectangle's top-left position as a Point. */
|
||||
const Point<ValueType>& getTopLeft() const noexcept { return pos; }
|
||||
Point<ValueType> getTopLeft() const noexcept { return pos; }
|
||||
|
||||
/** Returns the rectangle's top-right position as a Point. */
|
||||
Point<ValueType> getTopRight() const noexcept { return Point<ValueType> (pos.x + w, pos.y); }
|
||||
|
|
@ -188,7 +188,7 @@ public:
|
|||
Rectangle withPosition (const ValueType newX, const ValueType newY) const noexcept { return Rectangle (newX, newY, w, h); }
|
||||
|
||||
/** Returns a rectangle with the same size as this one, but a new position. */
|
||||
Rectangle withPosition (const Point<ValueType>& newPos) const noexcept { return Rectangle (newPos.x, newPos.y, w, h); }
|
||||
Rectangle withPosition (const Point<ValueType> newPos) const noexcept { return Rectangle (newPos.x, newPos.y, w, h); }
|
||||
|
||||
/** Returns a rectangle whose size is the same as this one, but whose top-left position is (0, 0). */
|
||||
Rectangle withZeroOrigin() const noexcept { return Rectangle (w, h); }
|
||||
|
|
@ -267,26 +267,26 @@ public:
|
|||
}
|
||||
|
||||
/** Returns a rectangle which is the same as this one moved by a given amount. */
|
||||
Rectangle operator+ (const Point<ValueType>& deltaPosition) const noexcept
|
||||
Rectangle operator+ (const Point<ValueType> deltaPosition) const noexcept
|
||||
{
|
||||
return Rectangle (pos.x + deltaPosition.x, pos.y + deltaPosition.y, w, h);
|
||||
}
|
||||
|
||||
/** Moves this rectangle by a given amount. */
|
||||
Rectangle& operator+= (const Point<ValueType>& deltaPosition) noexcept
|
||||
Rectangle& operator+= (const Point<ValueType> deltaPosition) noexcept
|
||||
{
|
||||
pos += deltaPosition;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Returns a rectangle which is the same as this one moved by a given amount. */
|
||||
Rectangle operator- (const Point<ValueType>& deltaPosition) const noexcept
|
||||
Rectangle operator- (const Point<ValueType> deltaPosition) const noexcept
|
||||
{
|
||||
return Rectangle (pos.x - deltaPosition.x, pos.y - deltaPosition.y, w, h);
|
||||
}
|
||||
|
||||
/** Moves this rectangle by a given amount. */
|
||||
Rectangle& operator-= (const Point<ValueType>& deltaPosition) noexcept
|
||||
Rectangle& operator-= (const Point<ValueType> deltaPosition) noexcept
|
||||
{
|
||||
pos -= deltaPosition;
|
||||
return *this;
|
||||
|
|
@ -459,7 +459,7 @@ public:
|
|||
}
|
||||
|
||||
/** Returns true if this co-ordinate is inside the rectangle. */
|
||||
bool contains (const Point<ValueType>& point) const noexcept
|
||||
bool contains (const Point<ValueType> point) const noexcept
|
||||
{
|
||||
return point.x >= pos.x && point.y >= pos.y && point.x < pos.x + w && point.y < pos.y + h;
|
||||
}
|
||||
|
|
@ -472,7 +472,7 @@ public:
|
|||
}
|
||||
|
||||
/** Returns the nearest point to the specified point that lies within this rectangle. */
|
||||
Point<ValueType> getConstrainedPoint (const Point<ValueType>& point) const noexcept
|
||||
Point<ValueType> getConstrainedPoint (const Point<ValueType> point) const noexcept
|
||||
{
|
||||
return Point<ValueType> (jlimit (pos.x, pos.x + w, point.x),
|
||||
jlimit (pos.y, pos.y + h, point.y));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue