Browse Source

Minor tidying-up.

tags/2021-05-28
jules 10 years ago
parent
commit
b8696a0ecd
2 changed files with 16 additions and 16 deletions
  1. +13
    -13
      modules/juce_graphics/geometry/juce_Line.h
  2. +3
    -3
      modules/juce_gui_basics/native/juce_ios_Windowing.mm

+ 13
- 13
modules/juce_graphics/geometry/juce_Line.h View File

@@ -224,8 +224,8 @@ public:
if (length <= 0)
return start;
return Point<ValueType> (start.x + static_cast <ValueType> ((delta.x * distanceFromStart - delta.y * perpendicularDistance) / length),
start.y + static_cast <ValueType> ((delta.y * distanceFromStart + delta.x * perpendicularDistance) / length));
return Point<ValueType> (start.x + static_cast<ValueType> ((delta.x * distanceFromStart - delta.y * perpendicularDistance) / length),
start.y + static_cast<ValueType> ((delta.y * distanceFromStart + delta.x * perpendicularDistance) / length));
}
/** Returns the location of the point which is a given distance along this line
@@ -267,7 +267,7 @@ public:
if (prop >= 0 && prop <= 1.0)
{
pointOnLine = start + delta * static_cast <ValueType> (prop);
pointOnLine = start + delta * static_cast<ValueType> (prop);
return targetPoint.getDistanceFrom (pointOnLine);
}
}
@@ -301,9 +301,9 @@ public:
const double length = delta.x * delta.x + delta.y * delta.y;
return length <= 0 ? 0
: jlimit (ValueType(), static_cast <ValueType> (1),
static_cast <ValueType> ((((point.x - start.x) * delta.x
+ (point.y - start.y) * delta.y) / length)));
: jlimit (ValueType(), static_cast<ValueType> (1),
static_cast<ValueType> ((((point.x - start.x) * delta.x
+ (point.y - start.y) * delta.y) / length)));
}
/** Finds the point on this line which is nearest to a given point.
@@ -375,40 +375,40 @@ private:
{
const ValueType along = (p1.y - p3.y) / d2.y;
intersection = p1.withX (p3.x + along * d2.x);
return along >= 0 && along <= static_cast <ValueType> (1);
return along >= 0 && along <= static_cast<ValueType> (1);
}
else if (d2.y == 0 && d1.y != 0)
{
const ValueType along = (p3.y - p1.y) / d1.y;
intersection = p3.withX (p1.x + along * d1.x);
return along >= 0 && along <= static_cast <ValueType> (1);
return along >= 0 && along <= static_cast<ValueType> (1);
}
else if (d1.x == 0 && d2.x != 0)
{
const ValueType along = (p1.x - p3.x) / d2.x;
intersection = p1.withY (p3.y + along * d2.y);
return along >= 0 && along <= static_cast <ValueType> (1);
return along >= 0 && along <= static_cast<ValueType> (1);
}
else if (d2.x == 0 && d1.x != 0)
{
const ValueType along = (p3.x - p1.x) / d1.x;
intersection = p3.withY (p1.y + along * d1.y);
return along >= 0 && along <= static_cast <ValueType> (1);
return along >= 0 && along <= static_cast<ValueType> (1);
}
}
intersection = (p2 + p3) / static_cast <ValueType> (2);
intersection = (p2 + p3) / static_cast<ValueType> (2);
return false;
}
const ValueType along1 = ((p1.y - p3.y) * d2.x - (p1.x - p3.x) * d2.y) / divisor;
intersection = p1 + d1 * along1;
if (along1 < 0 || along1 > static_cast <ValueType> (1))
if (along1 < 0 || along1 > static_cast<ValueType> (1))
return false;
const ValueType along2 = ((p1.y - p3.y) * d1.x - (p1.x - p3.x) * d1.y) / divisor;
return along2 >= 0 && along2 <= static_cast <ValueType> (1);
return along2 >= 0 && along2 <= static_cast<ValueType> (1);
}
};


+ 3
- 3
modules/juce_gui_basics/native/juce_ios_Windowing.mm View File

@@ -294,10 +294,10 @@ void SystemClipboard::copyTextToClipboard (const String& text)
String SystemClipboard::getTextFromClipboard()
{
NSString* text = [[UIPasteboard generalPasteboard] valueForPasteboardType: @"public.text"];
if (NSString* text = [[UIPasteboard generalPasteboard] valueForPasteboardType: @"public.text"])
return nsStringToJuce (text);
return text == nil ? String::empty
: nsStringToJuce (text);
return String();
}
//==============================================================================


Loading…
Cancel
Save