From 651d6a7ed8a34e8ef3b9f79e75b2099e77a80917 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Mon, 28 Feb 2011 23:48:34 -0300 Subject: [PATCH] Linting AppKit. --- AppKit/CPCursor.j | 4 +- AppKit/CPDragServer.j | 4 +- AppKit/CPSearchField.j | 2 +- AppKit/CPTableView.j | 12 +- AppKit/Cib/CPCib.j | 4 +- AppKit/Cib/CPCibConnector.j | 4 +- AppKit/CoreAnimation/CAAnimation.j | 12 +- AppKit/CoreAnimation/CABackingStore.j | 10 +- AppKit/CoreAnimation/CAFlashLayer.j | 8 +- AppKit/CoreAnimation/CALayer.j | 2 +- AppKit/CoreAnimation/CAMediaTimingFunction.j | 8 +- AppKit/CoreGraphics/CGColorSpace.j | 16 +-- AppKit/CoreGraphics/CGContextCanvas.j | 52 +++---- AppKit/CoreGraphics/CGContextVML.j | 140 +++++++++---------- AppKit/CoreGraphics/CGPath.j | 60 ++++---- 15 files changed, 169 insertions(+), 169 deletions(-) diff --git a/AppKit/CPCursor.j b/AppKit/CPCursor.j index 968b146a5..fd5c89eb5 100755 --- a/AppKit/CPCursor.j +++ b/AppKit/CPCursor.j @@ -9,7 +9,7 @@ Cursor support by browser: OS X/Opera 9 : All except disappearingItemCursor, closedHandCursor, openHandCursor, contextualMenuCursor, dragLinkCursor, dragCopyCursor, operationNotAllowedCursor, resizeUpDownCursor, resizeLeftRightCursor (no url() support) OS X/Opera 10 : All except disappearingItemCursor, closedHandCursor, contextualMenuCursor, dragLinkCursor, dragCopyCursor, operationNotAllowedCursor (no url() support) OS X/Opera 11 : All except disappearingItemCursor, closedHandCursor, contextualMenuCursor, dragLinkCursor, dragCopyCursor, operationNotAllowedCursor (no url() support) - Win XP/Chrome 8 : All + Win XP/Chrome 8 : All Win XP/Safari 5 : All Win XP/Firefox 3 : All Win XP/Firefox 3.5 : All @@ -53,7 +53,7 @@ var currentCursor = nil, } // foregroundColor and backgroundColor are ignored in Cocoa as well. See http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSCursor_Class/Reference/Reference.html -– (id)initWithImage:(CPImage)image foregroundColorHint:(CPColor)foregroundColor backgroundColorHint:(CPColor)backgroundColor hotSpot:(CPPoint)aHotSpot +- (id)initWithImage:(CPImage)image foregroundColorHint:(CPColor)foregroundColor backgroundColorHint:(CPColor)backgroundColor hotSpot:(CPPoint)aHotSpot { return [self initWithImage:image hotSpot:hotSpot]; } diff --git a/AppKit/CPDragServer.j b/AppKit/CPDragServer.j index 75314eb29..076500970 100644 --- a/AppKit/CPDragServer.j +++ b/AppKit/CPDragServer.j @@ -44,8 +44,8 @@ var CPDragServerPreviousEvent = nil, var CPSharedDragServer = nil; -var CPDragServerSource = nil; -var CPDragServerDraggingInfo = nil; +var CPDragServerSource = nil, + CPDragServerDraggingInfo = nil; /* CPDraggingInfo is a container of information about a specific dragging session. diff --git a/AppKit/CPSearchField.j b/AppKit/CPSearchField.j index 9557c0b54..1be2e07a4 100644 --- a/AppKit/CPSearchField.j +++ b/AppKit/CPSearchField.j @@ -181,7 +181,7 @@ var RECENT_SEARCH_PREFIX = @" "; [_cancelButton setFrame:[self cancelButtonRectForBounds:[self bounds]]]; [_cancelButton setAutoresizingMask:CPViewMinXMargin]; [_cancelButton setTarget:self]; - [_cancelButton setAction:@selector(cancelOperation:)]; + [_cancelButton setAction:@selector(cancelOperation:)]; [self _updateCancelButtonVisibility]; [self addSubview:_cancelButton]; } diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index bfddb39d0..d9f4fe97e 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -136,7 +136,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; CPTableView object displays record-oriented data in a table and allows the user to edit values and resize and rearrange columns. A CPTableView requires you to either set a data source which implements - @ref numberofrows "numberOfRowsInTableView:" and @ref objectValueForTable "tableView:objectValueForTableColumn:row:", + @ref numberofrows "numberOfRowsInTableView:" and @ref objectValueForTable "tableView:objectValueForTableColumn:row:", or alternatively to provide data through Key Value Bindings. To use a table view with Key Value Bindings, bind each column's @@ -420,7 +420,7 @@ The tableview will call this method if you click the tableheader. You should sor @code - (void)tableView:(CPTableView)aTableView sortDescriptorsDidChange:(CPArray)oldDescriptors; @endcode - + @section draganddrop Drag and Drop: @note In order for the tableview to receive drops don't forget to first register the tableview for drag types like you do with every other view. @@ -430,7 +430,7 @@ Return the drag operation (move, copy, etc) that should be performed if a regist @code - (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(CPDraggingInfo)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)operation; @endcode - + Returns YES if the drop operation is allowed otherwise NO. This method is invoked by the tableview after a drag should begin, but before it is started. If you don't want the drag to being return NO. If you want the drag to begin you should return YES and place the drag data on the pboard. @code - (BOOL)tableView:(CPTableView)aTableView writeRowsWithIndexes:(CPIndexSet)rowIndexes toPasteboard:(CPPasteboard)pboard; @@ -1987,7 +1987,7 @@ NOT YET IMPLEMENTED // find the last visisble column while (count-- && [_tableColumns[count] isHidden]) ; - + // find the max x, but subtract a single pixel since the spacing isn't applicable here. var delta = superviewWidth - _CGRectGetMaxX([self rectOfColumn:count]) - ([self intercellSpacing].width || 1), newSize = [item width] + delta; @@ -2309,7 +2309,7 @@ NOT YET IMPLEMENTED /*! @anchor setdelegate - Sets the delegate of the receiver. + Sets the delegate of the receiver. @param aDelegate the delegate object for the tableview. The delegate can provide easy notification for user interaction, display behaviour, contextual menus, and more. @@ -4593,7 +4593,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad var extend = (([theEvent modifierFlags] & CPShiftKeyMask) && _allowsMultipleSelection), i = [self selectedRow]; - if([self _selectionIsBroken]) + if ([self _selectionIsBroken]) { while ([selectedIndexes containsIndex:i]) { diff --git a/AppKit/Cib/CPCib.j b/AppKit/Cib/CPCib.j index 5cc8e4fd2..5686c5f21 100644 --- a/AppKit/Cib/CPCib.j +++ b/AppKit/Cib/CPCib.j @@ -38,7 +38,7 @@ CPCibOwner = @"CPCibOwner", CPCibTopLevelObjects = @"CPCibTopLevelObjects", CPCibReplacementClasses = @"CPCibReplacementClasses", CPCibExternalObjects = @"CPCibExternalObjects"; - + var CPCibObjectDataKey = @"CPCibObjectDataKey"; /*! @@ -87,7 +87,7 @@ var CPCibObjectDataKey = @"CPCibObjectDataKey"; { if (![aName hasSuffix:@".cib"]) aName = [aName stringByAppendingString:@".cib"]; - + // If aBundle is nil, use mainBundle, but ONLY for searching for the nib, not for resources later. self = [self initWithContentsOfURL:[aBundle || [CPBundle mainBundle] pathForResource:aName]]; diff --git a/AppKit/Cib/CPCibConnector.j b/AppKit/Cib/CPCibConnector.j index dc2e4c46b..78eddadc0 100644 --- a/AppKit/Cib/CPCibConnector.j +++ b/AppKit/Cib/CPCibConnector.j @@ -64,14 +64,14 @@ var _CPCibConnectorSourceKey = @"_CPCibConnectorSourceKey", - (id)initWithCoder:(CPCoder)aCoder { self = [super init]; - + if (self) { _source = [aCoder decodeObjectForKey:_CPCibConnectorSourceKey]; _destination = [aCoder decodeObjectForKey:_CPCibConnectorDestinationKey]; _label = [aCoder decodeObjectForKey:_CPCibConnectorLabelKey]; } - + return self; } diff --git a/AppKit/CoreAnimation/CAAnimation.j b/AppKit/CoreAnimation/CAAnimation.j index 06876996e..2f13f5d8b 100644 --- a/AppKit/CoreAnimation/CAAnimation.j +++ b/AppKit/CoreAnimation/CAAnimation.j @@ -46,10 +46,10 @@ - (id)init { self = [super init]; - + if (self) _isRemovedOnCompletion = YES; - + return self; } @@ -130,12 +130,12 @@ @end /* - + */ @implementation CAPropertyAnimation : CAAnimation { CPString _keyPath; - + BOOL _isCumulative; BOOL _isAdditive; } @@ -143,9 +143,9 @@ + (id)animationWithKeyPath:(CPString)aKeyPath { var animation = [self animation]; - + [animation setKeyPath:aKeyPath]; - + return animation; } diff --git a/AppKit/CoreAnimation/CABackingStore.j b/AppKit/CoreAnimation/CABackingStore.j index 9a0b53ce7..b0ea504c8 100644 --- a/AppKit/CoreAnimation/CABackingStore.j +++ b/AppKit/CoreAnimation/CABackingStore.j @@ -37,9 +37,9 @@ if (CPFeatureIsCompatible(CPHTMLCanvasFeature)) CABackingStoreCreate = function() { var DOMElement = document.createElement("canvas"); - + DOMElement.style.position = "absolute"; - + // FIXME: Consolidate drawImage to support this. return { context:DOMElement.getContext("2d"), buffer:DOMElement, _image:DOMElement }; } @@ -47,7 +47,7 @@ CABackingStoreCreate = function() CABackingStoreSetSize = function(aBackingStore, aSize) { var buffer = aBackingStore.buffer; - + buffer.width = aSize.width; buffer.height = aSize.height; buffer.style.width = PIXEL(aSize.width); @@ -60,9 +60,9 @@ else CABackingStoreCreate = function() { var context = CGBitmapGraphicsContextCreate(); - + context.buffer = ""; - + return { context:context }; } diff --git a/AppKit/CoreAnimation/CAFlashLayer.j b/AppKit/CoreAnimation/CAFlashLayer.j index f70af2587..ddeef2075 100644 --- a/AppKit/CoreAnimation/CAFlashLayer.j +++ b/AppKit/CoreAnimation/CAFlashLayer.j @@ -33,12 +33,12 @@ { if (_flashMovie == aFlashMovie) return; - + _flashMovie = aFlashMovie; - + _DOMElement.innerHTML = ""; } diff --git a/AppKit/CoreAnimation/CALayer.j b/AppKit/CoreAnimation/CALayer.j index f628bed6c..be88807f4 100644 --- a/AppKit/CoreAnimation/CALayer.j +++ b/AppKit/CoreAnimation/CALayer.j @@ -791,7 +791,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex) layer._runLoopUpdateMask = 0; } - window.loop= false; + window.loop = false; CALayerRegisteredRunLoopUpdates = nil; } diff --git a/AppKit/CoreAnimation/CAMediaTimingFunction.j b/AppKit/CoreAnimation/CAMediaTimingFunction.j index c75df75cf..62d20f194 100644 --- a/AppKit/CoreAnimation/CAMediaTimingFunction.j +++ b/AppKit/CoreAnimation/CAMediaTimingFunction.j @@ -45,13 +45,13 @@ var CAMediaNamedTimingFunctions = nil; if (!CAMediaNamedTimingFunctions) { CAMediaNamedTimingFunctions = [CPDictionary dictionary]; - + [CAMediaNamedTimingFunctions setObject:[CAMediaTimingFunction functionWithControlPoints:0.0 :0.0 :1.0 :1.0] forKey:kCAMediaTimingFunctionLinear]; [CAMediaNamedTimingFunctions setObject:[CAMediaTimingFunction functionWithControlPoints:0.42 :0.0 :1.0 :1.0] forKey:kCAMediaTimingFunctionEaseIn]; [CAMediaNamedTimingFunctions setObject:[CAMediaTimingFunction functionWithControlPoints:0.0 :0.0 :0.58 :1.0] forKey:kCAMediaTimingFunctionEaseOut]; [CAMediaNamedTimingFunctions setObject:[CAMediaTimingFunction functionWithControlPoints:0.42 :0.0 :0.58 :1.0] forKey:kCAMediaTimingFunctionEaseInEaseOut]; } - + return [CAMediaNamedTimingFunctions objectForKey:aName]; } @@ -63,7 +63,7 @@ var CAMediaNamedTimingFunctions = nil; - (id)initWithControlPoints:(float)c1x :(float)c1y :(float)c2x :(float)c2y { self = [super init]; - + if (self) { _c1x = c1x; @@ -71,7 +71,7 @@ var CAMediaNamedTimingFunctions = nil; _c2x = c2x; _c2y = c2y; } - + return self; } diff --git a/AppKit/CoreGraphics/CGColorSpace.j b/AppKit/CoreGraphics/CGColorSpace.j index 887b8ff2b..711d7725b 100644 --- a/AppKit/CoreGraphics/CGColorSpace.j +++ b/AppKit/CoreGraphics/CGColorSpace.j @@ -123,17 +123,17 @@ function CGColorSpaceCreatePattern(aBaseColorSpace) { if (aBaseColorSpace) return _CGColorSpaceCreateWithModel(kCGColorSpaceModelPattern, aBaseColorSpace.count, aBaseColorSpace); - + return _CGColorSpaceCreateWithModel(kCGColorSpaceModelPattern, 0, NULL); } function CGColorSpaceCreateWithName(aName) { var colorSpace = _CGNamedColorSpaces[aName]; - + if (colorSpace) return colorSpace; - + switch (aName) { case kCGColorSpaceGenericGray: return _CGNamedColorSpaces[aName] = _CGColorSpaceCreateWithModel(kCGColorSpaceModelMonochrome, 1, NULL); @@ -144,7 +144,7 @@ function CGColorSpaceCreateWithName(aName) case kCGColorSpaceAdobeRGB1998: return _CGNamedColorSpaces[aName] = _CGColorSpaceCreateWithModel(kCGColorSpaceModelRGB, 3, NULL); case kCGColorSpaceSRGB: return _CGNamedColorSpaces[aName] = _CGColorSpaceCreateWithModel(kCGColorSpaceModelRGB, 3, NULL); } - + return NULL; } @@ -214,9 +214,9 @@ function CGColorSpaceRetain(aColorSpace) function CGColorSpaceStandardizeComponents(aColorSpace, components) { var count = aColorSpace.count; - - // Standardize the alpha value. We allow the alpha value to have a - // higher precision than other components since it is not ultimately + + // Standardize the alpha value. We allow the alpha value to have a + // higher precision than other components since it is not ultimately // bound to 256 bits like RGB. STANDARDIZE(components, count, 0, 1, 1000); @@ -231,7 +231,7 @@ function CGColorSpaceStandardizeComponents(aColorSpace, components) case kCGColorSpaceModelDeviceN: while (count--) STANDARDIZE(components, count, 0, 1, 255); break; - + // We don't currently support these color spaces. case kCGColorSpaceModelIndexed: case kCGColorSpaceModelLab: diff --git a/AppKit/CoreGraphics/CGContextCanvas.j b/AppKit/CoreGraphics/CGContextCanvas.j index 1e123a6bf..b13ac4c13 100644 --- a/AppKit/CoreGraphics/CGContextCanvas.j +++ b/AppKit/CoreGraphics/CGContextCanvas.j @@ -22,12 +22,12 @@ var CANVAS_LINECAP_TABLE = [ "butt", "round", "square" ], CANVAS_LINEJOIN_TABLE = [ "miter", "round", "bevel" ], - CANVAS_COMPOSITE_TABLE = [ "source-over", "source-over", "source-over", "source-over", "darker", - "lighter", "source-over", "source-over", "source-over", "source-over", - "source-over", "source-over", "source-over", "source-over", "source-over", - "source-over", "source-over", - "copy", "source-in", "source-out", "source-atop", - "destination-over", "destination-in", "destination-out", "destination-atop", + CANVAS_COMPOSITE_TABLE = [ "source-over", "source-over", "source-over", "source-over", "darker", + "lighter", "source-over", "source-over", "source-over", "source-over", + "source-over", "source-over", "source-over", "source-over", "source-over", + "source-over", "source-over", + "copy", "source-in", "source-out", "source-atop", + "destination-over", "destination-in", "destination-out", "destination-atop", "xor", "source-over", "source-over" ]; #define _CGContextAddArcCanvas(aContext, x, y, radius, startAngle, endAngle, anticlockwise) aContext.arc(x, y, radius, startAngle, endAngle, anticlockwise) @@ -106,15 +106,15 @@ function CGContextAddPath(aContext, aPath) return; var elements = aPath.elements, - + i = 0, count = aPath.count; - + for (; i < count; ++i) { var element = elements[i], type = element.type; - + switch (type) { case kCGPathElementMoveToPoint: _CGContextMoveToPointCanvas(aContext, element.x, element.y); @@ -143,10 +143,10 @@ function CGContextAddRect(aContext, aRect) function CGContextAddRects(aContext, rects, count) { var i = 0; - + if (arguments["count"] == NULL) var count = rects.length; - + for (; i < count; ++i) { var rect = rects[i]; @@ -180,7 +180,7 @@ function CGContextDrawPath(aContext, aMode) aContext.fill(); else if (aMode == kCGPathEOFill || aMode == kCGPathEOFillStroke) alert("not implemented!!!"); - + if (aMode == kCGPathStroke || aMode == kCGPathFillStroke || aMode == kCGPathEOFillStroke) aContext.stroke(); } @@ -193,10 +193,10 @@ function CGContextFillRect(aContext, aRect) function CGContextFillRects(aContext, rects, count) { var i = 0; - + if (arguments["count"] == NULL) var count = rects.length; - + for (; i < count; ++i) { var rect = rects[i]; @@ -219,7 +219,7 @@ function CGContextClipToRect(aContext, aRect) _CGContextBeginPathCanvas(aContext); _CGContextAddRectCanvas(aContext, aRect); _CGContextClosePathCanvas(aContext); - + _CGContextClipCanvas(aContext); } @@ -302,7 +302,7 @@ function CGContextTranslateCTM(aContext, tx, ty) sx = (abs_cos * a / cos + abs_sin * -c / sin) / (abs_cos + abs_sin);\ sy = (abs_cos * d / cos + abs_sin * b / sin) / (abs_cos + abs_sin);\ }\ - + #define rotate_scale(a, b, c, d) \ var sign = (a * d < 0.0 || b * c > 0.0) ? -1.0 : 1.0;\ a1 = (Math.atan2(sign * b, sign * a) + Math.atan2(-c, d)) / 2.0,\ @@ -350,7 +350,7 @@ CGContextConcatCTM = function(aContext, anAffineTransform) { var a = anAffineTransform.a, b = anAffineTransform.b, - c = anAffineTransform.c, + c = anAffineTransform.c, d = anAffineTransform.d, tx = anAffineTransform.tx, ty = anAffineTransform.ty, @@ -365,13 +365,13 @@ CGContextConcatCTM = function(aContext, anAffineTransform) sx = a; sy = d; } - + // a scale followed by a rotate else if (a * b == -c * d) { scale_rotate(a, b, c, d) } - + // rotate, then scale. else if (a * c == -b * d) { @@ -384,8 +384,8 @@ CGContextConcatCTM = function(aContext, anAffineTransform) v = eigen(CGAffineTransformConcat(transpose, anAffineTransform)), U = CGAffineTransformMake(u.vector_1.x, u.vector_2.x, u.vector_1.y, u.vector_2.y, 0.0, 0.0), // inline VT = CGAffineTransformMake(v.vector_1.x, v.vector_1.y, v.vector_2.x, v.vector_2.y, 0.0, 0.0), - S = CGAffineTransformConcat(CGAffineTransformConcat(CGAffineTransformInvert(U), anAffineTransform), CGAffineTransformInvert(VT)); - + S = CGAffineTransformConcat(CGAffineTransformConcat(CGAffineTransformInvert(U), anAffineTransform), CGAffineTransformInvert(VT)); + a = VT.a; b = VT.b; c = VT.c; @@ -401,7 +401,7 @@ CGContextConcatCTM = function(aContext, anAffineTransform) sx = S.a * sx; sy = S.d * sy; } - + if (tx != 0 || ty != 0) CGContextTranslateCTM(aContext, tx, ty); if (a1 != 0.0) @@ -428,12 +428,12 @@ function CGContextDrawLinearGradient(aContext, aGradient, aStartPoint, anEndPoin { var colors = aGradient.colors, count = colors.length, - + linearGradient = aContext.createLinearGradient(aStartPoint.x, aStartPoint.y, anEndPoint.x, anEndPoint.y); while (count--) linearGradient.addColorStop(aGradient.locations[count], to_string(colors[count])); - + aContext.fillStyle = linearGradient; aContext.fill(); } @@ -442,8 +442,8 @@ function CGBitmapGraphicsContextCreate() { var DOMElement = document.createElement("canvas"), context = DOMElement.getContext("2d"); - + context.DOMElement = DOMElement; - + return context; } diff --git a/AppKit/CoreGraphics/CGContextVML.j b/AppKit/CoreGraphics/CGContextVML.j index b1196004e..28f62cbae 100644 --- a/AppKit/CoreGraphics/CGContextVML.j +++ b/AppKit/CoreGraphics/CGContextVML.j @@ -32,9 +32,9 @@ function CGBitmapGraphicsContextCreate() // The first time around, we have to set up our environment to support vml. document.namespaces.add("cg_vml_", "urn:schemas-microsoft-com:vml"); document.createStyleSheet().cssText = "cg_vml_\\:*{behavior:url(#default#VML)}"; - + CGBitmapGraphicsContextCreate = _CGBitmapGraphicsContextCreate; - + return _CGBitmapGraphicsContextCreate(); } @@ -45,7 +45,7 @@ function CGContextClearRect(aContext, aRect) aContext.buffer = ""; else aContext.DOMElement.innerHTML = ""; - + aContext.path = NULL; } @@ -59,7 +59,7 @@ var W = 10.0, function CGContextDrawImage(aContext, aRect, anImage) { var string = ""; - + if (anImage.buffer != nil) string = anImage.buffer; else @@ -68,24 +68,24 @@ function CGContextDrawImage(aContext, aRect, anImage) origin = CGPointApplyAffineTransform(aRect.origin, ctm), similarity = ctm.a == ctm.d && ctm.b == -ctm.c, vml = [""); - + string = vml.join(""); } - + if (aContext.buffer != nil) aContext.buffer += string; else @@ -111,74 +111,74 @@ function CGContextDrawPath(aContext, aMode) { if (!aContext || CGPathIsEmpty(aContext.path)) return; - + var elements = aContext.path.elements, - + i = 0, count = aContext.path.count, - + gState = aContext.gState, fill = (aMode == kCGPathFill || aMode == kCGPathFillStroke) ? 1 : 0, stroke = (aMode == kCGPathStroke || aMode == kCGPathFillStroke) ? 1 : 0, opacity = gState.alpha, - vml = [ ""); - + if (gState.gradient) vml.push(gState.gradient) - + else if (fill) vml.push(""); - + if (stroke) - vml.push( ""); - + var shadowColor = gState.shadowColor; //\"", [shadowColor cssString], "\" if (shadowColor) { var shadowOffset = gState.shadowOffset; - - vml.push(""); } - + vml.push(""); if (aContext.buffer != nil) @@ -270,25 +270,25 @@ function CGContextDrawLinearGradient(aContext, aGradient, aStartPoint, anEndPoin { if (!aContext || !aGradient) return; - + var vml = nil; - + if (aGradient.vml_gradient) { var stops = [[aGradient.vml_gradient stops] sortedArrayUsingSelector:@selector(comparePosition:)], count = [stops count]; - + vml = [""); } - + aContext.gState.gradient = vml.join(""); - + // if (aContext.buffer != nil) // aContext.buffer += vml.join(""); // else diff --git a/AppKit/CoreGraphics/CGPath.j b/AppKit/CoreGraphics/CGPath.j index bd2a6b393..5dde217cb 100644 --- a/AppKit/CoreGraphics/CGPath.j +++ b/AppKit/CoreGraphics/CGPath.j @@ -53,9 +53,9 @@ function CGPathCreateMutable() function CGPathCreateMutableCopy(aPath) { var path = CGPathCreateMutable(); - + CGPathAddPath(path, aPath); - + return path; } @@ -99,7 +99,7 @@ function CGPathAddArc(aPath, aTransform, x, y, aRadius, aStartAngle, anEndAngle, aStartAngle = ATAN2(start.y - aTransform.ty, start.x - aTransform.tx); // Angles that equal "modulo" 2 pi return as equal after transforming them, - // so we have to make sure to make them different again if they were different + // so we have to make sure to make them different again if they were different // to start out with. It's the difference between no circle and a full circle. if (anEndAngle == aStartAngle && oldEndAngle != oldStartAngle) if (oldStartAngle > oldEndAngle) @@ -111,7 +111,7 @@ function CGPathAddArc(aPath, aTransform, x, y, aRadius, aStartAngle, anEndAngle, aRadius = _CGSizeApplyAffineTransform(aRadius, aTransform); aRadius = SQRT(aRadius.width * aRadius.width + aRadius.height * aRadius.height); } - + aPath.current = _CGPointMake(x + aRadius * COS(anEndAngle), y + aRadius * SIN(anEndAngle)); aPath.elements[aPath.count++] = { type:kCGPathElementAddArc, x:x, y:y, radius:aRadius, startAngle:aStartAngle, endAngle:anEndAngle }; } @@ -125,14 +125,14 @@ function CGPathAddCurveToPoint(aPath, aTransform, cp1x, cp1y, cp2x, cp2y, x, y) var cp1 = _CGPointMake(cp1x, cp1y), cp2 = _CGPointMake(cp2x, cp2y), end = _CGPointMake(x, y); - + if (aTransform) { cp1 = _CGPointApplyAffineTransform(cp1, aTransform); cp2 = _CGPointApplyAffineTransform(cp2, aTransform); end = _CGPointApplyAffineTransform(end, aTransform); } - + aPath.current = end; aPath.elements[aPath.count++] = { type:kCGPathElementAddCurveToPoint, cp1x:cp1.x, cp1y:cp1.y, cp2x:cp2.x, cp2y:cp2.y, x:end.x, y:end.y }; } @@ -140,13 +140,13 @@ function CGPathAddCurveToPoint(aPath, aTransform, cp1x, cp1y, cp2x, cp2y, x, y) function CGPathAddLines(aPath, aTransform, points, count) { var i = 1; - + if (arguments["count"] == NULL) var count = points.length; - + if (!aPath || count < 2) return; - + CGPathMoveToPoint(aPath, aTransform, points[0].x, points[0].y); for (; i < count; ++i) @@ -156,7 +156,7 @@ function CGPathAddLines(aPath, aTransform, points, count) function CGPathAddLineToPoint(aPath, aTransform, x, y) { var point = _CGPointMake(x, y); - + if (aTransform != NULL) point = _CGPointApplyAffineTransform(point, aTransform); @@ -204,13 +204,13 @@ function CGPathAddQuadCurveToPoint(aPath, aTransform, cpx, cpy, x, y) { var cp = _CGPointMake(cpx, cpy), end = _CGPointMake(x, y); - + if (aTransform) { cp = _CGPointApplyAffineTransform(cp, aTransform); end = _CGPointApplyAffineTransform(end, aTransform); } - + aPath.elements[aPath.count++] = { type:kCGPathElementAddQuadCurveToPoint, cpx:cp.x, cpy:cp.y, x:end.x, y:end.y } aPath.current = end; } @@ -223,19 +223,19 @@ function CGPathAddRect(aPath, aTransform, aRect) function CGPathAddRects(aPath, aTransform, rects, count) { var i = 0; - + if (arguments["count"] == NULL) var count = rects.length; - + for (; i < count; ++i) { var rect = rects[i]; - + CGPathMoveToPoint(aPath, aTransform, _CGRectGetMinX(rect), _CGRectGetMinY(rect)); CGPathAddLineToPoint(aPath, aTransform, _CGRectGetMaxX(rect), _CGRectGetMinY(rect)); CGPathAddLineToPoint(aPath, aTransform, _CGRectGetMaxX(rect), _CGRectGetMaxY(rect)); CGPathAddLineToPoint(aPath, aTransform, _CGRectGetMinX(rect), _CGRectGetMaxY(rect)); - + CGPathCloseSubpath(aPath); } } @@ -244,15 +244,15 @@ function CGPathMoveToPoint(aPath, aTransform, x, y) { var point = _CGPointMake(x, y), count = aPath.count; - + if (aTransform != NULL) point = _CGPointApplyAffineTransform(point, aTransform); aPath.start = point; aPath.current = point; - + var previous = aPath.elements[count - 1]; - + if (count != 0 && previous.type == kCGPathElementMoveToPoint) { previous.x = point.x; @@ -338,11 +338,11 @@ function CGPathWithRoundedRectangleInRect(aRect, xRadius, yRadius/*not currently function CGPathCloseSubpath(aPath) { var count = aPath.count; - + // Don't bother closing this subpath if there aren't any current elements, or the last element already closed the subpath. if (count == 0 || aPath.elements[count - 1].type == kCGPathElementCloseSubpath) return; - + aPath.elements[aPath.count++] = { type:kCGPathElementCloseSubpath, points:[aPath.start] }; } @@ -350,32 +350,32 @@ function CGPathEqualToPath(aPath, anotherPath) { if (aPath == anotherPath) return YES; - + if (aPath.count != anotherPath.count || !_CGPointEqualToPoint(aPath.start, anotherPath.start) || !_CGPointEqualToPoint(aPath.current, anotherPath.current)) return NO; - + var i = 0, count = aPath.count; - + for (; i < count; ++i) { var element = aPath[i], anotherElement = anotherPath[i]; - + if (element.type != anotherElement.type) return NO; - - if ((element.type == kCGPathElementAddArc || element.type == kCGPathElementAddArcToPoint) && + + if ((element.type == kCGPathElementAddArc || element.type == kCGPathElementAddArcToPoint) && element.radius != anotherElement.radius) return NO; - + var j = element.points.length; - + while (j--) if (!_CGPointEqualToPoint(element.points[j], anotherElement.points[j])) return NO; } - + return YES; }