diff --git a/AsyncDisplayKit/ASTextNode.mm b/AsyncDisplayKit/ASTextNode.mm index c8170154d0..2fc5d619f9 100644 --- a/AsyncDisplayKit/ASTextNode.mm +++ b/AsyncDisplayKit/ASTextNode.mm @@ -338,7 +338,7 @@ ASDISPLAYNODE_INLINE CGFloat ceilPixelValue(CGFloat f) // Draw text bounds.origin = parameters.textOrigin; - [parameters.renderer drawInRect:bounds isRasterizing:isRasterizing]; + [parameters.renderer drawInRect:bounds inContext:context]; CGContextRestoreGState(context); } diff --git a/AsyncDisplayKit/Details/ASTextNodeRenderer.h b/AsyncDisplayKit/Details/ASTextNodeRenderer.h index 2ed4a8aeaf..aaaaf5a24f 100644 --- a/AsyncDisplayKit/Details/ASTextNodeRenderer.h +++ b/AsyncDisplayKit/Details/ASTextNodeRenderer.h @@ -60,8 +60,7 @@ typedef NS_ENUM(NSUInteger, ASTextNodeRendererMeasureOption) { * Draw the renderer's text content into the bounds provided. * * @param bounds The rect in which to draw the contents of the renderer. - * @param isRasterizing If YES, the renderer will not draw its background color - * within the bounds. + * @param context The CGContext in which to draw the contents of the renderer. * * @discussion Note that if a shadow is to be drawn, then the text will actually * draw inside a region that is inset from the bounds provided. Use @@ -72,7 +71,7 @@ typedef NS_ENUM(NSUInteger, ASTextNodeRendererMeasureOption) { * You may want to consider triggering this cost before hitting the draw method * if you are sensitive to this cost in drawInRect... */ -- (void)drawInRect:(CGRect)bounds isRasterizing:(BOOL)isRasterizing; +- (void)drawInRect:(CGRect)bounds inContext:(CGContextRef)context; #pragma mark - Layout diff --git a/AsyncDisplayKit/Details/ASTextNodeRenderer.mm b/AsyncDisplayKit/Details/ASTextNodeRenderer.mm index 39e068767d..06acd27722 100644 --- a/AsyncDisplayKit/Details/ASTextNodeRenderer.mm +++ b/AsyncDisplayKit/Details/ASTextNodeRenderer.mm @@ -578,11 +578,10 @@ static const CGFloat ASTextNodeRendererTextCapHeightPadding = 1.3; #pragma mark - Drawing -- (void)drawInRect:(CGRect)bounds isRasterizing:(BOOL)isRasterizing +- (void)drawInRect:(CGRect)bounds inContext:(CGContextRef)context { - CGContextRef context = UIGraphicsGetCurrentContext(); ASDisplayNodeAssert(context, @"This is no good without a context."); - + UIGraphicsPushContext(context); CGContextSaveGState(context); [self _initializeTextKitComponentsIfNeeded]; @@ -594,6 +593,7 @@ static const CGFloat ASTextNodeRendererTextCapHeightPadding = 1.3; } CGContextRestoreGState(context); + UIGraphicsPopContext(); } #pragma mark - String Ranges