Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit d41ef55

Browse files
Hannah TroisiAdlai Holler
authored andcommitted
[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
1 parent 6736367 commit d41ef55

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

AsyncDisplayKit/UIImage+ASConvenience.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ + (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius
7676
PathKey key = { roundedCorners, cornerRadius };
7777
NSValue *pathKeyObject = [[NSValue alloc] initWithBytes:&key objCType:@encode(PathKey)];
7878

79+
CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius);
7980
UIBezierPath *path = [__pathCache objectForKey:pathKeyObject];
8081
if (path == nil) {
81-
CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius);
8282
path = [UIBezierPath bezierPathWithRoundedRect:bounds byRoundingCorners:roundedCorners cornerRadii:cornerRadii];
8383
[__pathCache setObject:path forKey:pathKeyObject];
8484
}
@@ -107,7 +107,9 @@ + (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius
107107

108108
// It is rarer to have a stroke path, and our cache key only handles rounded rects for the exact-stretchable
109109
// size calculated by cornerRadius, so we won't bother caching this path. Profiling validates this decision.
110-
UIBezierPath *strokePath = [UIBezierPath bezierPathWithRoundedRect:strokeRect cornerRadius:cornerRadius];
110+
UIBezierPath *strokePath = [UIBezierPath bezierPathWithRoundedRect:strokeRect
111+
byRoundingCorners:roundedCorners
112+
cornerRadii:cornerRadii];
111113
[strokePath setLineWidth:borderWidth];
112114
BOOL canUseCopy = (CGColorGetAlpha(borderColor.CGColor) == 1);
113115
[strokePath strokeWithBlendMode:(canUseCopy ? kCGBlendModeCopy : kCGBlendModeNormal) alpha:1];

0 commit comments

Comments
 (0)