From d41ef55cd739d6181724c9b4fa4be525c1eebb2d Mon Sep 17 00:00:00 2001 From: Hannah Troisi Date: Wed, 18 Jan 2017 11:13:58 -0800 Subject: [PATCH] [UIImage+ASConvenience] as_resizableRoundedImage border doesn't respect roundedCorner argument (#2905) * fix border path on as_resizableRoundedImageWithCornerRadius... method * add a space to force this PR to rebuild * Revert added space --- AsyncDisplayKit/UIImage+ASConvenience.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AsyncDisplayKit/UIImage+ASConvenience.m b/AsyncDisplayKit/UIImage+ASConvenience.m index 3af1435acb..7f999d12cf 100644 --- a/AsyncDisplayKit/UIImage+ASConvenience.m +++ b/AsyncDisplayKit/UIImage+ASConvenience.m @@ -76,9 +76,9 @@ PathKey key = { roundedCorners, cornerRadius }; NSValue *pathKeyObject = [[NSValue alloc] initWithBytes:&key objCType:@encode(PathKey)]; + CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius); UIBezierPath *path = [__pathCache objectForKey:pathKeyObject]; if (path == nil) { - CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius); path = [UIBezierPath bezierPathWithRoundedRect:bounds byRoundingCorners:roundedCorners cornerRadii:cornerRadii]; [__pathCache setObject:path forKey:pathKeyObject]; } @@ -107,7 +107,9 @@ // It is rarer to have a stroke path, and our cache key only handles rounded rects for the exact-stretchable // size calculated by cornerRadius, so we won't bother caching this path. Profiling validates this decision. - UIBezierPath *strokePath = [UIBezierPath bezierPathWithRoundedRect:strokeRect cornerRadius:cornerRadius]; + UIBezierPath *strokePath = [UIBezierPath bezierPathWithRoundedRect:strokeRect + byRoundingCorners:roundedCorners + cornerRadii:cornerRadii]; [strokePath setLineWidth:borderWidth]; BOOL canUseCopy = (CGColorGetAlpha(borderColor.CGColor) == 1); [strokePath strokeWithBlendMode:(canUseCopy ? kCGBlendModeCopy : kCGBlendModeNormal) alpha:1];