mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
CoreGraphics: Prevent an assertion when creating a rounded rectangle
This commit is contained in:
parent
fdf74a7477
commit
c545ca0492
1 changed files with 8 additions and 2 deletions
|
|
@ -638,7 +638,10 @@ void CoreGraphicsContext::drawRoundedRectangle (const Rectangle<float>& r, float
|
|||
CGContextSetLineCap (context.get(), kCGLineCapButt);
|
||||
CGContextSetLineJoin (context.get(), kCGLineJoinMiter);
|
||||
|
||||
detail::PathPtr path { CGPathCreateWithRoundedRect (convertToCGRectFlipped (r), cornerSize, cornerSize, nullptr) };
|
||||
detail::PathPtr path { CGPathCreateWithRoundedRect (convertToCGRectFlipped (r),
|
||||
std::clamp (cornerSize, 0.0f, r.getWidth() / 2.0f),
|
||||
std::clamp (cornerSize, 0.0f, r.getHeight() / 2.0f),
|
||||
nullptr) };
|
||||
CGContextAddPath (context.get(), path.get());
|
||||
drawCurrentPath (kCGPathStroke);
|
||||
}
|
||||
|
|
@ -669,7 +672,10 @@ void CoreGraphicsContext::drawRoundedRectangle (const Rectangle<float>& r, float
|
|||
void CoreGraphicsContext::fillRoundedRectangle (const Rectangle<float>& r, float cornerSize)
|
||||
{
|
||||
CGContextBeginPath (context.get());
|
||||
detail::PathPtr path { CGPathCreateWithRoundedRect (convertToCGRectFlipped (r), cornerSize, cornerSize, nullptr) };
|
||||
detail::PathPtr path { CGPathCreateWithRoundedRect (convertToCGRectFlipped (r),
|
||||
std::clamp (cornerSize, 0.0f, r.getWidth() / 2.0f),
|
||||
std::clamp (cornerSize, 0.0f, r.getHeight() / 2.0f),
|
||||
nullptr) };
|
||||
CGContextAddPath (context.get(), path.get());
|
||||
drawCurrentPath (kCGPathFill);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue