Revision: 24181
http://sourceforge.net/p/bibdesk/svn/24181
Author: hofman
Date: 2019-09-02 13:47:54 +0000 (Mon, 02 Sep 2019)
Log Message:
-----------
don't implement rund rect code when never needed
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVUtilities.m
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVUtilities.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVUtilities.m 2019-09-02
06:30:37 UTC (rev 24180)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVUtilities.m 2019-09-02
13:47:54 UTC (rev 24181)
@@ -487,35 +487,37 @@
+ (NSBezierPath*)fv_bezierPathWithRoundRect:(NSRect)rect
xRadius:(CGFloat)xRadius yRadius:(CGFloat)yRadius;
{
- if ([self
respondsToSelector:@selector(bezierPathWithRoundedRect:xRadius:yRadius:)])
- return [self bezierPathWithRoundedRect:rect xRadius:xRadius
yRadius:yRadius];
-
- // Make sure radius doesn't exceed a maximum size to avoid artifacts:
- CGFloat mr = MIN(NSHeight(rect), NSWidth(rect));
- CGFloat radius = MIN(xRadius, 0.5f * mr);
-
- // Make sure silly values simply lead to un-rounded corners:
- if( radius <= 0 )
- return [self bezierPathWithRect:rect];
-
- NSRect innerRect = NSInsetRect(rect, radius, radius); // Make rect with
corners being centers of the corner circles.
- NSBezierPath *path = [self bezierPath];
-
- // Now draw our rectangle:
- [path moveToPoint: NSMakePoint(NSMinX(innerRect) - radius,
NSMinY(innerRect))];
-
- // Bottom left (origin):
- [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(innerRect),
NSMinY(innerRect)) radius:radius startAngle:180.0 endAngle:270.0];
- // Bottom edge and bottom right:
- [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(innerRect),
NSMinY(innerRect)) radius:radius startAngle:270.0 endAngle:360.0];
- // Left edge and top right:
- [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(innerRect),
NSMaxY(innerRect)) radius:radius startAngle:0.0 endAngle:90.0 ];
- // Top edge and top left:
- [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(innerRect),
NSMaxY(innerRect)) radius:radius startAngle:90.0 endAngle:180.0];
- // Left edge:
- [path closePath];
-
- return path;
+#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+ if (NO == [self
respondsToSelector:@selector(bezierPathWithRoundedRect:xRadius:yRadius:)]) {
+ // Make sure radius doesn't exceed a maximum size to avoid artifacts:
+ CGFloat mr = MIN(NSHeight(rect), NSWidth(rect));
+ CGFloat radius = MIN(xRadius, 0.5f * mr);
+
+ // Make sure silly values simply lead to un-rounded corners:
+ if( radius <= 0 )
+ return [self bezierPathWithRect:rect];
+
+ NSRect innerRect = NSInsetRect(rect, radius, radius); // Make rect
with corners being centers of the corner circles.
+ NSBezierPath *path = [self bezierPath];
+
+ // Now draw our rectangle:
+ [path moveToPoint: NSMakePoint(NSMinX(innerRect) - radius,
NSMinY(innerRect))];
+
+ // Bottom left (origin):
+ [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(innerRect),
NSMinY(innerRect)) radius:radius startAngle:180.0 endAngle:270.0];
+ // Bottom edge and bottom right:
+ [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(innerRect),
NSMinY(innerRect)) radius:radius startAngle:270.0 endAngle:360.0];
+ // Left edge and top right:
+ [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(innerRect),
NSMaxY(innerRect)) radius:radius startAngle:0.0 endAngle:90.0 ];
+ // Top edge and top left:
+ [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(innerRect),
NSMaxY(innerRect)) radius:radius startAngle:90.0 endAngle:180.0];
+ // Left edge:
+ [path closePath];
+
+ return path;
+ }
+#endif
+ return [self bezierPathWithRoundedRect:rect xRadius:xRadius
yRadius:yRadius];
}
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit