mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-13 06:01:28 +00:00
More capp_linting.
Reviewed by me.
This commit is contained in:
@@ -31,7 +31,7 @@ function CFHashCode(aCFObject)
|
||||
{
|
||||
if (!aCFObject.hash)
|
||||
aCFObject.hash = ++CFTypeGlobalCount;
|
||||
|
||||
|
||||
return aCFObject;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ function CGColorGetConstantColor(aColorName)
|
||||
}
|
||||
|
||||
/*!
|
||||
This function is for source compatability.
|
||||
This function is for source compatability.
|
||||
*/
|
||||
function CGColorRetain(aColor)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ function CGColorRetain(aColor)
|
||||
}
|
||||
|
||||
/*!
|
||||
This function is for source compatability.
|
||||
This function is for source compatability.
|
||||
*/
|
||||
function CGColorRelease()
|
||||
{
|
||||
@@ -74,14 +74,14 @@ function CGColorCreate(aColorSpace, components)
|
||||
return NULL;
|
||||
|
||||
var components = components.slice();
|
||||
|
||||
|
||||
CGColorSpaceStandardizeComponents(aColorSpace, components);
|
||||
|
||||
|
||||
var UID = CFHashCode(aColorSpace) + components.join("");
|
||||
|
||||
|
||||
if (_CGColorMap[UID])
|
||||
return _CGColorMap[UID];
|
||||
|
||||
|
||||
return _CGColorMap[UID] = { colorspace:aColorSpace, pattern:NULL, components:components };
|
||||
}
|
||||
|
||||
@@ -150,9 +150,9 @@ function CGColorCreateGenericCMYK(cyan, magenta, yellow, black, alpha)
|
||||
function CGColorCreateCopyWithAlpha(aColor, anAlpha)
|
||||
{
|
||||
var components = aColor.components;
|
||||
|
||||
|
||||
if (!aColor || anAlpha == components[components.length - 1])
|
||||
return aColor;
|
||||
return aColor;
|
||||
|
||||
if (aColor.pattern)
|
||||
var copy = CGColorCreateWithPattern(aColor.colorspace, aColor.pattern, components);
|
||||
@@ -160,7 +160,7 @@ function CGColorCreateCopyWithAlpha(aColor, anAlpha)
|
||||
var copy = CGColorCreate(aColor.colorspace, components);
|
||||
|
||||
copy.components[components.length - 1] = anAlpha;
|
||||
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ function CGColorEqualToColor(lhs, rhs)
|
||||
{
|
||||
if (lhs == rhs)
|
||||
return true;
|
||||
|
||||
|
||||
if (!lhs || !rhs)
|
||||
return false;
|
||||
|
||||
@@ -201,17 +201,17 @@ function CGColorEqualToColor(lhs, rhs)
|
||||
|
||||
if (lhsComponentCount != rhsComponents.length)
|
||||
return false;
|
||||
|
||||
while (lhsComponentCount--)
|
||||
|
||||
while (lhsComponentCount--)
|
||||
if (lhsComponents[lhsComponentCount] != rhsComponents[lhsComponentCount])
|
||||
return false;
|
||||
|
||||
|
||||
if (lhs.pattern != rhs.pattern)
|
||||
return false;
|
||||
|
||||
|
||||
if (CGColorSpaceEqualToColorSpace(lhs.colorspace, rhs.colorspace))
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ function CGColorEqualToColor(lhs, rhs)
|
||||
function CGColorGetAlpha(aColor)
|
||||
{
|
||||
var components = aColor.components;
|
||||
|
||||
|
||||
return components[components.length - 1];
|
||||
}
|
||||
|
||||
@@ -273,13 +273,13 @@ function CGColorGetPattern(aColor)
|
||||
}
|
||||
|
||||
/* var components = aColor.components;
|
||||
|
||||
|
||||
case : _CGCSSForColor[CFGetHash(aColor)] = "rgba(" + ROUND(components[0] * 255.0) + ',' + ROUND(components[0] * 255.0) + ',' ROUND(components[0] * 255.0) + ',' + ROUND(components[0] * 255.0);
|
||||
_cssString = (hasAlpha ? "rgba(" : "rgb(") +
|
||||
parseInt(_components[0] * 255.0) + ", " +
|
||||
parseInt(_components[1] * 255.0) + ", " +
|
||||
parseInt(_components[2] * 255.0) +
|
||||
(hasAlpha ? (", " + _components[3]) : "") + ")";
|
||||
_cssString = (hasAlpha ? "rgba(" : "rgb(") +
|
||||
parseInt(_components[0] * 255.0) + ", " +
|
||||
parseInt(_components[1] * 255.0) + ", " +
|
||||
parseInt(_components[2] * 255.0) +
|
||||
(hasAlpha ? (", " + _components[3]) : "") + ")";
|
||||
|
||||
function CFStringFromColor()
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
kCGLineCapButt = 0;
|
||||
kCGLineCapRound = 1;
|
||||
kCGLineCapRound = 1;
|
||||
kCGLineCapSquare = 2;
|
||||
|
||||
kCGLineJoinMiter = 0;
|
||||
@@ -114,8 +114,8 @@ if (!CPFeatureIsCompatible(CPHTMLCanvasFeature))
|
||||
*/
|
||||
function CGGStateCreate()
|
||||
{
|
||||
return { alpha:1.0, strokeStyle:"#000", fillStyle:"#ccc", lineWidth:1.0, lineJoin:kCGLineJoinMiter, lineCap:kCGLineCapButt, miterLimit:10.0, globalAlpha:1.0,
|
||||
blendMode:kCGBlendModeNormal,
|
||||
return { alpha:1.0, strokeStyle:"#000", fillStyle:"#ccc", lineWidth:1.0, lineJoin:kCGLineJoinMiter, lineCap:kCGLineCapButt, miterLimit:10.0, globalAlpha:1.0,
|
||||
blendMode:kCGBlendModeNormal,
|
||||
shadowOffset:_CGSizeMakeZero(), shadowBlur:0.0, shadowColor:NULL, CTM:_CGAffineTransformMakeIdentity() };
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ function CGGStateCreate()
|
||||
*/
|
||||
function CGGStateCreateCopy(aGState)
|
||||
{
|
||||
return { alpha:aGState.alpha, strokeStyle:aGState.strokeStyle, fillStyle:aGState.fillStyle, lineWidth:aGState.lineWidth,
|
||||
lineJoin:aGState.lineJoin, lineCap:aGState.lineCap, miterLimit:aGState.miterLimit, globalAlpha:aGState.globalAlpha,
|
||||
blendMode:aGState.blendMode,
|
||||
return { alpha:aGState.alpha, strokeStyle:aGState.strokeStyle, fillStyle:aGState.fillStyle, lineWidth:aGState.lineWidth,
|
||||
lineJoin:aGState.lineJoin, lineCap:aGState.lineCap, miterLimit:aGState.miterLimit, globalAlpha:aGState.globalAlpha,
|
||||
blendMode:aGState.blendMode,
|
||||
shadowOffset:aGState.shadowOffset, shadowBlur:aGState.shadowBlur, shadowColor:aGState.shadowColor, CTM:_CGAffineTransformMakeCopy(aGState.CTM) };
|
||||
}
|
||||
|
||||
@@ -256,10 +256,10 @@ function CGContextAddPath(aContext, aPath)
|
||||
{
|
||||
if (!aContext || CGPathIsEmpty(aPath))
|
||||
return;
|
||||
|
||||
|
||||
if (!aContext.path)
|
||||
aContext.path = CGPathCreateMutable();
|
||||
|
||||
|
||||
CGPathAddPath(aContext.path, aContext.gState.CTM, aPath);
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ function CGContextMoveToPoint(aContext, x, y)
|
||||
{
|
||||
if (!aContext.path)
|
||||
aContext.path = CGPathCreateMutable();
|
||||
|
||||
|
||||
CGPathMoveToPoint(aContext.path, aContext.gState.CTM, x, y);
|
||||
}
|
||||
|
||||
@@ -358,11 +358,11 @@ function CGContextFillRects(aContext, rects, count)
|
||||
{
|
||||
if (arguments[2] === undefined)
|
||||
var count = rects.length;
|
||||
|
||||
|
||||
CGContextBeginPath(aContext);
|
||||
CGContextAddRects(aContext, rects, count);
|
||||
CGContextClosePath(aContext);
|
||||
|
||||
|
||||
CGContextDrawPath(aContext, kCGPathFill);
|
||||
}
|
||||
|
||||
@@ -373,11 +373,11 @@ function CGContextFillRects(aContext, rects, count)
|
||||
@return void
|
||||
*/
|
||||
function CGContextStrokeRect(aContext, aRect)
|
||||
{
|
||||
{
|
||||
CGContextBeginPath(aContext);
|
||||
CGContextAddRect(aContext, aRect);
|
||||
CGContextClosePath(aContext);
|
||||
|
||||
|
||||
CGContextDrawPath(aContext, kCGPathStroke);
|
||||
}
|
||||
|
||||
@@ -391,10 +391,10 @@ function CGContextStrokeRect(aContext, aRect)
|
||||
function CGContextStrokeRectWithWidth(aContext, aRect, aWidth)
|
||||
{
|
||||
CGContextSaveGState(aContext);
|
||||
|
||||
|
||||
CGContextSetLineWidth(aContext, aWidth);
|
||||
CGContextStrokeRect(aContext, aRect);
|
||||
|
||||
|
||||
CGContextRestoreGState(aContext);
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ function CGContextStrokeRectWithWidth(aContext, aRect, aWidth)
|
||||
function CGContextConcatCTM(aContext, aTransform)
|
||||
{
|
||||
var CTM = aContext.gState.CTM;
|
||||
|
||||
|
||||
_CGAffineTransformConcatTo(CTM, aTransform, CTM);
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ function CGContextGetCTM(aContext)
|
||||
function CGContextRotateCTM(aContext, anAngle)
|
||||
{
|
||||
var gState = aContext.gState;
|
||||
|
||||
|
||||
gState.CTM = CGAffineTransformRotate(gState.CTM, anAngle);
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ function CGContextRotateCTM(aContext, anAngle)
|
||||
function CGContextScaleCTM(aContext, sx, sy)
|
||||
{
|
||||
var gState = aContext.gState;
|
||||
|
||||
|
||||
gState.CTM = _CGAffineTransformScale(gState.CTM, sx, sy);
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ function CGContextScaleCTM(aContext, sx, sy)
|
||||
function CGContextTranslateCTM(aContext, tx, ty)
|
||||
{
|
||||
var gState = aContext.gState;
|
||||
|
||||
|
||||
gState.CTM = _CGAffineTransformTranslate(gState.CTM, tx, ty);
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ function CGContextTranslateCTM(aContext, tx, ty)
|
||||
function CGContextSetShadow(aContext, aSize, aBlur)
|
||||
{
|
||||
var gState = aContext.gState;
|
||||
|
||||
|
||||
gState.shadowOffset = _CGSizeMakeCopy(aSize);
|
||||
gState.shadowBlur = aBlur;
|
||||
gState.shadowColor = [CPColor shadowColor];
|
||||
@@ -491,7 +491,7 @@ function CGContextSetShadow(aContext, aSize, aBlur)
|
||||
function CGContextSetShadowWithColor(aContext, aSize, aBlur, aColor)
|
||||
{
|
||||
var gState = aContext.gState;
|
||||
|
||||
|
||||
gState.shadowOffset = _CGSizeMakeCopy(aSize);
|
||||
gState.shadowBlur = aBlur;
|
||||
gState.shadowColor = aColor;
|
||||
@@ -605,10 +605,10 @@ function CGContextStrokePath(aContext)
|
||||
function CGContextStrokeLineSegments(aContext, points, count)
|
||||
{
|
||||
var i = 0;
|
||||
|
||||
|
||||
if (arguments["count"] == NULL)
|
||||
var count = points.length;
|
||||
|
||||
|
||||
CGContextBeginPath(aContext);
|
||||
|
||||
for (; i < count; i += 2)
|
||||
@@ -616,7 +616,7 @@ function CGContextStrokeLineSegments(aContext, points, count)
|
||||
CGContextMoveToPoint(aContext, points[i].x, points[i].y);
|
||||
CGContextAddLineToPoint(aContext, points[i + 1].x, points[i + 1].y);
|
||||
}
|
||||
|
||||
|
||||
CGContextStrokePath(aContext);
|
||||
}
|
||||
|
||||
@@ -681,12 +681,12 @@ function CGContextFillRoundedRectangleInRect(aContext, aRect, aRadius, ne, se, s
|
||||
function CGContextStrokeRoundedRectangleInRect(aContext, aRect, aRadius, ne, se, sw, nw)
|
||||
{
|
||||
CGContextBeginPath(aContext);
|
||||
CGContextAddPath(aContext, CGPathWithRoundedRectangleInRect(aRect, aRadius, aRadius, ne, se, sw, nw));
|
||||
CGContextAddPath(aContext, CGPathWithRoundedRectangleInRect(aRect, aRadius, aRadius, ne, se, sw, nw));
|
||||
CGContextClosePath(aContext);
|
||||
CGContextStrokePath(aContext);
|
||||
}
|
||||
|
||||
/*!
|
||||
/*!
|
||||
@}
|
||||
*/
|
||||
|
||||
|
||||
@@ -267,21 +267,21 @@ var KAPPA = 4.0 * ((SQRT2 - 1.0) / 3.0);
|
||||
function CGPathWithEllipseInRect(aRect)
|
||||
{
|
||||
var path = CGPathCreateMutable();
|
||||
|
||||
if (_CGRectGetWidth(aRect) == _CGRectGetHeight(aRect))
|
||||
|
||||
if (_CGRectGetWidth(aRect) == _CGRectGetHeight(aRect))
|
||||
CGPathAddArc(path, nil, _CGRectGetMidX(aRect), _CGRectGetMidY(aRect), _CGRectGetWidth(aRect) / 2.0, 0.0, 2 * PI, YES);
|
||||
else
|
||||
{
|
||||
var axis = _CGSizeMake(_CGRectGetWidth(aRect) / 2.0, _CGRectGetHeight(aRect) / 2.0),
|
||||
center = _CGPointMake(_CGRectGetMinX(aRect) + axis.width, _CGRectGetMinY(aRect) + axis.height);
|
||||
else
|
||||
{
|
||||
var axis = _CGSizeMake(_CGRectGetWidth(aRect) / 2.0, _CGRectGetHeight(aRect) / 2.0),
|
||||
center = _CGPointMake(_CGRectGetMinX(aRect) + axis.width, _CGRectGetMinY(aRect) + axis.height);
|
||||
|
||||
CGPathMoveToPoint(path, nil, center.x, center.y - axis.height);
|
||||
|
||||
CGPathAddCurveToPoint(path, nil, center.x + (KAPPA * axis.width), center.y - axis.height, center.x + axis.width, center.y - (KAPPA * axis.height), center.x + axis.width, center.y);
|
||||
CGPathAddCurveToPoint(path, nil, center.x + axis.width, center.y + (KAPPA * axis.height), center.x + (KAPPA * axis.width), center.y + axis.height, center.x, center.y + axis.height);
|
||||
CGPathAddCurveToPoint(path, nil, center.x - (KAPPA * axis.width), center.y + axis.height, center.x - axis.width, center.y + (KAPPA * axis.height), center.x - axis.width, center.y);
|
||||
CGPathAddCurveToPoint(path, nil, center.x - axis.width, center.y - (KAPPA * axis.height), center.x - (KAPPA * axis.width), center.y - axis.height, center.x, center.y - axis.height);
|
||||
}
|
||||
|
||||
CGPathAddCurveToPoint(path, nil, center.x + (KAPPA * axis.width), center.y - axis.height, center.x + axis.width, center.y - (KAPPA * axis.height), center.x + axis.width, center.y);
|
||||
CGPathAddCurveToPoint(path, nil, center.x + axis.width, center.y + (KAPPA * axis.height), center.x + (KAPPA * axis.width), center.y + axis.height, center.x, center.y + axis.height);
|
||||
CGPathAddCurveToPoint(path, nil, center.x - (KAPPA * axis.width), center.y + axis.height, center.x - axis.width, center.y + (KAPPA * axis.height), center.x - axis.width, center.y);
|
||||
CGPathAddCurveToPoint(path, nil, center.x - axis.width, center.y - (KAPPA * axis.height), center.x - (KAPPA * axis.width), center.y - axis.height, center.x, center.y - axis.height);
|
||||
}
|
||||
|
||||
CGPathCloseSubpath(path);
|
||||
|
||||
@@ -297,37 +297,38 @@ function CGPathWithRoundedRectangleInRect(aRect, xRadius, yRadius/*not currently
|
||||
yMax = _CGRectGetMaxY(aRect);
|
||||
|
||||
CGPathMoveToPoint(path, nil, xMin + xRadius, yMin);
|
||||
|
||||
if (ne)
|
||||
{
|
||||
CGPathAddLineToPoint(path, nil, xMax - xRadius, yMin);
|
||||
CGPathAddCurveToPoint(path, nil, xMax - xRadius, yMin, xMax, yMin, xMax, yMin + xRadius);
|
||||
}
|
||||
else
|
||||
CGPathAddLineToPoint(path, nil, xMax, yMin);
|
||||
|
||||
if (se)
|
||||
{
|
||||
CGPathAddLineToPoint(path, nil, xMax, yMax - xRadius);
|
||||
CGPathAddCurveToPoint(path, nil, xMax, yMax - xRadius, xMax, yMax, xMax - xRadius, yMax);
|
||||
}
|
||||
else
|
||||
CGPathAddLineToPoint(path, nil, xMax, yMax);
|
||||
|
||||
if (sw)
|
||||
{
|
||||
CGPathAddLineToPoint(path, nil, xMin + xRadius, yMax);
|
||||
CGPathAddCurveToPoint(path, nil, xMin + xRadius, yMax, xMin, yMax, xMin, yMax - xRadius);
|
||||
}
|
||||
else
|
||||
CGPathAddLineToPoint(path, nil, xMin, yMax);
|
||||
|
||||
if (nw)
|
||||
{
|
||||
CGPathAddLineToPoint(path, nil, xMin, yMin + xRadius);
|
||||
CGPathAddCurveToPoint(path, nil, xMin, yMin + xRadius, xMin, yMin, xMin + xRadius, yMin);
|
||||
} else
|
||||
CGPathAddLineToPoint(path, nil, xMin, yMin);
|
||||
|
||||
if (ne)
|
||||
{
|
||||
CGPathAddLineToPoint(path, nil, xMax - xRadius, yMin);
|
||||
CGPathAddCurveToPoint(path, nil, xMax - xRadius, yMin, xMax, yMin, xMax, yMin + xRadius);
|
||||
}
|
||||
else
|
||||
CGPathAddLineToPoint(path, nil, xMax, yMin);
|
||||
|
||||
if (se)
|
||||
{
|
||||
CGPathAddLineToPoint(path, nil, xMax, yMax - xRadius);
|
||||
CGPathAddCurveToPoint(path, nil, xMax, yMax - xRadius, xMax, yMax, xMax - xRadius, yMax);
|
||||
}
|
||||
else
|
||||
CGPathAddLineToPoint(path, nil, xMax, yMax);
|
||||
|
||||
if (sw)
|
||||
{
|
||||
CGPathAddLineToPoint(path, nil, xMin + xRadius, yMax);
|
||||
CGPathAddCurveToPoint(path, nil, xMin + xRadius, yMax, xMin, yMax, xMin, yMax - xRadius);
|
||||
}
|
||||
else
|
||||
CGPathAddLineToPoint(path, nil, xMin, yMax);
|
||||
|
||||
if (nw)
|
||||
{
|
||||
CGPathAddLineToPoint(path, nil, xMin, yMin + xRadius);
|
||||
CGPathAddCurveToPoint(path, nil, xMin, yMin + xRadius, xMin, yMin, xMin + xRadius, yMin);
|
||||
}
|
||||
else
|
||||
CGPathAddLineToPoint(path, nil, xMin, yMin);
|
||||
|
||||
CGPathCloseSubpath(path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user