[ASTextNode] Fix ASTextNode shadow is not rendering (#2042)

* Passing through shadow in renderer attribute

* Fix memory leak setting shadow color
This commit is contained in:
Michael Schneider
2016-08-09 14:56:59 -07:00
committed by Adlai Holler
parent 03c74452b2
commit d9db780b0b

View File

@@ -44,6 +44,7 @@ struct ASTextNodeDrawParameter {
@implementation ASTextNode {
CGSize _shadowOffset;
CGColorRef _shadowColor;
UIColor *_cachedShadowUIColor;
CGFloat _shadowOpacity;
CGFloat _shadowRadius;
@@ -232,6 +233,10 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
.pointSizeScaleFactors = self.pointSizeScaleFactors,
.layoutManagerCreationBlock = self.layoutManagerCreationBlock,
.textStorageCreationBlock = self.textStorageCreationBlock,
.shadowOffset = _shadowOffset,
.shadowColor = _cachedShadowUIColor,
.shadowOpacity = _shadowOpacity,
.shadowRadius = _shadowRadius
};
}
@@ -1043,7 +1048,11 @@ static CGRect ASTextNodeAdjustRenderRectForShadowPadding(CGRect rendererRect, UI
if (shadowColor != NULL) {
CGColorRetain(shadowColor);
}
if (_shadowColor != NULL) {
CGColorRelease(_shadowColor);
}
_shadowColor = shadowColor;
_cachedShadowUIColor = [UIColor colorWithCGColor:shadowColor];
[self _invalidateRenderer];
[self setNeedsDisplay];
}