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

Commit 3e89cf0

Browse files
maickigarrettmoon
authored andcommitted
[ASTextNode] Fix ASTextNode shadow is not rendering (#2042)
* Passing through shadow in renderer attribute * Fix memory leak setting shadow color
1 parent 0e32802 commit 3e89cf0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

AsyncDisplayKit/ASTextNode.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ @interface ASTextNode () <UIGestureRecognizerDelegate, NSLayoutManagerDelegate>
4444
@implementation ASTextNode {
4545
CGSize _shadowOffset;
4646
CGColorRef _shadowColor;
47+
UIColor *_cachedShadowUIColor;
4748
CGFloat _shadowOpacity;
4849
CGFloat _shadowRadius;
4950

@@ -244,6 +245,10 @@ - (ASTextKitAttributes)_rendererAttributes
244245
.pointSizeScaleFactors = self.pointSizeScaleFactors,
245246
.layoutManagerCreationBlock = self.layoutManagerCreationBlock,
246247
.textStorageCreationBlock = self.textStorageCreationBlock,
248+
.shadowOffset = _shadowOffset,
249+
.shadowColor = _cachedShadowUIColor,
250+
.shadowOpacity = _shadowOpacity,
251+
.shadowRadius = _shadowRadius
247252
};
248253
}
249254

@@ -1055,7 +1060,11 @@ - (void)setShadowColor:(CGColorRef)shadowColor
10551060
if (shadowColor != NULL) {
10561061
CGColorRetain(shadowColor);
10571062
}
1063+
if (_shadowColor != NULL) {
1064+
CGColorRelease(_shadowColor);
1065+
}
10581066
_shadowColor = shadowColor;
1067+
_cachedShadowUIColor = [UIColor colorWithCGColor:shadowColor];
10591068
[self _invalidateRenderer];
10601069
[self setNeedsDisplay];
10611070
}

0 commit comments

Comments
 (0)