@@ -473,17 +473,9 @@ + (UIImage *)createContentsForkey:(ASImageNodeContentsKey *)key drawParameters:(
473
473
return nil ;
474
474
}
475
475
476
- // If the image is opaque, and the draw rect contains the bounds rect, we can use an opaque context.
477
- UIImage *image = key.image ;
478
- const CGRect imageDrawRect = key.imageDrawRect ;
479
- const CGRect contextBounds = { CGPointZero , key.backingSize };
480
- const BOOL imageIsOpaque = ASImageAlphaInfoIsOpaque (CGImageGetAlphaInfo (image.CGImage ));
481
- const BOOL imageFillsContext = CGRectContainsRect (imageDrawRect, contextBounds);
482
- const BOOL contextIsOpaque = (imageIsOpaque && imageFillsContext) || key.isOpaque ;
483
-
484
476
// Use contentsScale of 1.0 and do the contentsScale handling in boundsSizeInPixels so ASCroppedImageBackingSizeAndDrawRectInBounds
485
477
// will do its rounding on pixel instead of point boundaries
486
- ASGraphicsBeginImageContextWithOptions (contextBounds. size , contextIsOpaque , 1.0 );
478
+ ASGraphicsBeginImageContextWithOptions (key. backingSize , key. isOpaque , 1.0 );
487
479
488
480
BOOL contextIsClean = YES ;
489
481
@@ -511,12 +503,13 @@ + (UIImage *)createContentsForkey:(ASImageNodeContentsKey *)key drawParameters:(
511
503
// upon removal of the object from the set when the operation completes.
512
504
// Another option is to have ASDisplayNode+AsyncDisplay coordinate these cases, and share the decoded buffer.
513
505
// Details tracked in https://github.com/facebook/AsyncDisplayKit/issues/1068
514
-
515
- BOOL canUseCopy = (contextIsClean || imageIsOpaque);
506
+
507
+ UIImage *image = key.image ;
508
+ BOOL canUseCopy = (contextIsClean || ASImageAlphaInfoIsOpaque (CGImageGetAlphaInfo (image.CGImage )));
516
509
CGBlendMode blendMode = canUseCopy ? kCGBlendModeCopy : kCGBlendModeNormal ;
517
510
518
511
@synchronized (image) {
519
- [image drawInRect: imageDrawRect blendMode: blendMode alpha: 1 ];
512
+ [image drawInRect: key. imageDrawRect blendMode: blendMode alpha: 1 ];
520
513
}
521
514
522
515
if (context && key.didDisplayNodeContentWithRenderingContext ) {
0 commit comments