Linting AppKit.

This commit is contained in:
Alexander Ljungberg
2011-02-28 23:48:34 -03:00
parent 383dcd5ee6
commit 651d6a7ed8
15 changed files with 169 additions and 169 deletions
+2 -2
View File
@@ -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];
}
+2 -2
View File
@@ -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.
+1 -1
View File
@@ -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];
}
+6 -6
View File
@@ -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])
{
+2 -2
View File
@@ -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]];
+2 -2
View File
@@ -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;
}
+6 -6
View File
@@ -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;
}
+5 -5
View File
@@ -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 };
}
+4 -4
View File
@@ -33,12 +33,12 @@
{
if (_flashMovie == aFlashMovie)
return;
_flashMovie = aFlashMovie;
_DOMElement.innerHTML = "<object width = \"100%\" height = \"100%\"><param name = \"movie\" value = \"" +
aFlashMovie._fileName +
"\"></param><param name = \"wmode\" value = \"transparent\"></param><embed src = \"" +
aFlashMovie._fileName +
"\"></param><param name = \"wmode\" value = \"transparent\"></param><embed src = \"" +
aFlashMovie._fileName + "\" type = \"application/x-shockwave-flash\" wmode = \"transparent\" width = \"100%\" height = \"100%\"></embed></object>";
}
+1 -1
View File
@@ -791,7 +791,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex)
layer._runLoopUpdateMask = 0;
}
window.loop= false;
window.loop = false;
CALayerRegisteredRunLoopUpdates = nil;
}
+4 -4
View File
@@ -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;
}
+8 -8
View File
@@ -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:
+26 -26
View File
@@ -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;
}
+70 -70
View File
@@ -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 = ["<cg_vml_:group coordsize=\"1,1\" coordorigin=\"0,0\" style=\"width:1;height:1;position:absolute"];
/*if (similarity)
{
var angle = CGPointMake(1.0, 0.0);
angle = _CGPointApplyAffineTransform(angle, ctm);
vml.push(";rotation:", ATAN2(angle.y - ctm.ty, angle.x - ctm.tx) * 180 / PI);
}*/
// Only create a filter if absolutely necessary. This actually
// turns out to only be the case if our transform matrix is not
// a similarity matrix, that is to say, the transform actually
// Only create a filter if absolutely necessary. This actually
// turns out to only be the case if our transform matrix is not
// a similarity matrix, that is to say, the transform actually
// morphs the shape beyond scaling and rotation.
//if (!similarity && (ctm.a != 1.0 || ctm.b || ctm.c || ctm.d != 1.0))
{
var transformedRect = CGRectApplyAffineTransform(aRect, ctm);
vml.push( ";padding:0 ", ROUND(_CGRectGetMaxX(transformedRect)), "px ", ROUND(_CGRectGetMaxY(transformedRect)),
"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",
"M11='", ctm.a, "',M12='", ctm.c, "',M21='", ctm.b, "',M22='", ctm.d, "',",
@@ -93,14 +93,14 @@ function CGContextDrawImage(aContext, aRect, anImage)
}
//else
// vml.push(";top:", ROUND(origin.y - 0.5), "px;left:", ROUND(origin.x - 0.5), "px;");
vml.push( "\"><cg_vml_:image src=\"", anImage._image.src,
"\" style=\"width:", _CGRectGetWidth(aRect), "px;height:", _CGRectGetHeight(aRect),
vml.push( "\"><cg_vml_:image src=\"", anImage._image.src,
"\" style=\"width:", _CGRectGetWidth(aRect), "px;height:", _CGRectGetHeight(aRect),
"px;\"/></g_vml_:group>");
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 = [ "<cg_vml_:shape",
" fillcolor=\"", gState.fillStyle,
"\" filled=\"", VML_TRUTH_TABLE[fill],
"\" style=\"position:absolute;width:", W, ";height:", H,
";\" coordorigin=\"0 0\" coordsize=\"", Z * W, " ", Z * H,
"\" stroked=\"", VML_TRUTH_TABLE[stroke],
"\" strokeweight=\"", gState.lineWidth,
"\" strokecolor=\"", gState.strokeStyle,
vml = [ "<cg_vml_:shape",
" fillcolor=\"", gState.fillStyle,
"\" filled=\"", VML_TRUTH_TABLE[fill],
"\" style=\"position:absolute;width:", W, ";height:", H,
";\" coordorigin=\"0 0\" coordsize=\"", Z * W, " ", Z * H,
"\" stroked=\"", VML_TRUTH_TABLE[stroke],
"\" strokeweight=\"", gState.lineWidth,
"\" strokecolor=\"", gState.strokeStyle,
"\" path=\""];
for (; i < count; ++i)
{
var element = elements[i],
type = element.type;
switch(type)
switch (type)
{
case kCGPathElementMoveToPoint:
case kCGPathElementMoveToPoint:
case kCGPathElementAddLineToPoint: vml.push(VML_ELEMENT_TABLE[type], COORD(element.x), ',', COORD(element.y));
break;
case kCGPathElementAddQuadCurveToPoint: vml.push(VML_ELEMENT_TABLE[type],
case kCGPathElementAddQuadCurveToPoint: vml.push(VML_ELEMENT_TABLE[type],
COORD(element.cpx), ',', COORD(element.cpy), ',',
COORD(element.x), ',', COORD(element.y));
break;
case kCGPathElementAddCurveToPoint: vml.push(VML_ELEMENT_TABLE[type],
case kCGPathElementAddCurveToPoint: vml.push(VML_ELEMENT_TABLE[type],
COORD(element.cp1x), ',', COORD(element.cp1y), ',',
COORD(element.cp2x), ',', COORD(element.cp2y), ',',
COORD(element.x), ',', COORD(element.y));
break;
case kCGPathElementCloseSubpath: vml.push(VML_ELEMENT_TABLE[type]);
break;
case kCGPathElementAddArc: var x = element.x,
y = element.y,
radius = element.radius,
clockwise = element.clockwise ? 1 : 0,
endAngle = element.endAngle,
startAngle = element.startAngle,
start = _CGPointMake(x + radius * COS(startAngle), y + radius * SIN(startAngle));
// If the angle's are equal, then we won't actually draw an arc, but instead
// If the angle's are equal, then we won't actually draw an arc, but instead
// simply move to its start/end to get the proper fill.
// We only need this special case for anti-clockwise because start == end is
// We only need this special case for anti-clockwise because start == end is
// interpreted as a full circle with anti-clockwise, but empty for clockwise.
if (startAngle == endAngle && !clockwise)
{
vml.push(VML_ELEMENT_TABLE[kCGPathElementMoveToPoint], COORD(start.x), ',', COORD(start.y));
continue;
}
var end = _CGPointMake(x + radius * COS(endAngle), y + radius * SIN(endAngle));
// Only do the start correction if the angles aren't equal. If they are, then
// Only do the start correction if the angles aren't equal. If they are, then
// let the circle be empty.
// FIXME: Should this be |star.x - end.x| < 0.125 ?
if (clockwise && startAngle != endAngle && _CGPointEqualToPoint(start, end))
@@ -196,10 +196,10 @@ function CGContextDrawPath(aContext, aMode)
else
end.y += 0.125;
}
vml.push(VML_ELEMENT_TABLE[type][clockwise],
COORD(x - radius), ',', COORD(y - radius), " ",
COORD(x + radius), ',', COORD(y + radius), " ",
vml.push(VML_ELEMENT_TABLE[type][clockwise],
COORD(x - radius), ',', COORD(y - radius), " ",
COORD(x + radius), ',', COORD(y + radius), " ",
COORD(start.x), ',', COORD(start.y), " ",
COORD(end.x), ',', COORD(end.y));
break;
@@ -228,31 +228,31 @@ function CGContextDrawPath(aContext, aMode)
}
vml.push("\">");
if (gState.gradient)
vml.push(gState.gradient)
else if (fill)
vml.push("<cg_vml_:fill color=\"", gState.fillStyle, "\" opacity=\"", opacity, "\" />");
if (stroke)
vml.push( "<cg_vml_:stroke opacity=\"", opacity,
"\" joinstyle=\"", VML_LINEJOIN_TABLE[gState.lineJoin],
"\" miterlimit=\"", gState.miterLimit,
"\" endcap=\"", VML_LINECAP_TABLE[gState.lineCap],
vml.push( "<cg_vml_:stroke opacity=\"", opacity,
"\" joinstyle=\"", VML_LINEJOIN_TABLE[gState.lineJoin],
"\" miterlimit=\"", gState.miterLimit,
"\" endcap=\"", VML_LINECAP_TABLE[gState.lineCap],
"\" weight=\"", gState.lineWidth, "",
"px\" color=\"", gState.strokeStyle,"\" />");
var shadowColor = gState.shadowColor;
//\"", [shadowColor cssString], "\"
if (shadowColor)
{
var shadowOffset = gState.shadowOffset;
vml.push("<cg_vml_:shadow on=\"t\" offset=\"",
vml.push("<cg_vml_:shadow on=\"t\" offset=\"",
shadowOffset.width, "pt ", shadowOffset.height, "pt\" opacity=\"", [shadowColor alphaComponent], "\" color=black />");
}
vml.push("</cg_vml_:shape>");
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 = ["<cg_vml_:fill type=\"gradient\" method=\"linear sigma\" "];
vml.push("angle=\"" + ([aGradient.vml_gradient angle] + 90) +"\" ");
vml.push("angle=\"" + ([aGradient.vml_gradient angle] + 90) + "\" ");
vml.push("colors=\"");
for (var i = 0; i < count; i++)
{
vml.push(([stops[i] position]*100).toFixed(0)+"% ");
vml.push(([stops[i] position] * 100).toFixed(0) + "% ");
vml.push([[[stops[i] color] colorForSlideBase:nil] cssString]);
if (i < count-1)
if (i < count - 1)
vml.push(",");
}
@@ -308,9 +308,9 @@ function CGContextDrawLinearGradient(aContext, aGradient, aStartPoint, anEndPoin
vml.push("\" />");
}
aContext.gState.gradient = vml.join("");
// if (aContext.buffer != nil)
// aContext.buffer += vml.join("");
// else
+30 -30
View File
@@ -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;
}