Fixed bug about border in CPBox lineBorder

This commit is contained in:
Alexandre Wilhelm
2013-01-16 11:48:23 -08:00
parent 35f495ef5b
commit 29d56b63f7
+12 -6
View File
@@ -492,16 +492,22 @@ CPBelowBottom = 6;
- (void)_drawLineBorderInRect:(CGRect)aRect
{
var context = [[CPGraphicsContext currentContext] graphicsPort],
sides = [CPMinYEdge, CPMaxXEdge, CPMaxYEdge, CPMinXEdge],
sideGray = 190.0 / 255.0,
grays = [142.0 / 255.0, sideGray, sideGray, sideGray],
cornerRadius = [self cornerRadius],
borderWidth = [self borderWidth];
while (borderWidth--)
aRect = CPDrawTiledRects(aRect, aRect, sides, grays);
aRect = CGRectInset(aRect, borderWidth / 2.0, borderWidth / 2.0);
// clip the canvas to the actual content view in order to only display inner shadow
CGContextBeginPath(context);
CGContextAddPath(context, CGPathWithRoundedRectangleInRect(aRect, cornerRadius, cornerRadius, YES, YES, YES, YES));
CGContextClip(context);
CGContextSetFillColor(context, [self fillColor]);
CGContextFillRect(context, aRect);
CGContextSetStrokeColor(context, [self borderColor]);
CGContextSetLineWidth(context, borderWidth);
CGContextFillRoundedRectangleInRect(context, aRect, cornerRadius, YES, YES, YES, YES);
CGContextStrokeRoundedRectangleInRect(context, aRect, cornerRadius, YES, YES, YES, YES);
}
- (void)_drawBezelBorderInRect:(CGRect)aRect