@@ -273,35 +273,24 @@ - (UIImage *)displayWithParameters:(id<NSObject> *)parameter isCancelled:(asdisp
273273 return nil ;
274274 }
275275
276- CGRect drawParameterBounds = CGRectZero;
277- BOOL forceUpscaling = NO ;
278- CGSize forcedSize = CGSizeZero;
279- BOOL cropEnabled = YES ;
280- BOOL isOpaque = NO ;
281- UIColor *backgroundColor = nil ;
282- UIViewContentMode contentMode = UIViewContentModeScaleAspectFill;
283- CGFloat contentsScale = 0.0 ;
284- CGRect cropDisplayBounds = CGRectZero;
285- CGRect cropRect = CGRectZero;
286- asimagenode_modification_block_t imageModificationBlock;
287-
276+ ASImageNodeDrawParameters drawParameter;
288277 {
289278 ASDN::MutexLocker l (__instanceLock__);
290- ASImageNodeDrawParameters drawParameter = _drawParameter;
291-
292- drawParameterBounds = drawParameter.bounds ;
293- forceUpscaling = drawParameter.forceUpscaling ;
294- forcedSize = drawParameter.forcedSize ;
295- cropEnabled = drawParameter.cropEnabled ;
296- isOpaque = drawParameter.opaque ;
297- backgroundColor = drawParameter.backgroundColor ;
298- contentMode = drawParameter.contentMode ;
299- contentsScale = drawParameter.contentsScale ;
300- cropDisplayBounds = drawParameter.cropDisplayBounds ;
301- cropRect = drawParameter.cropRect ;
302- imageModificationBlock = drawParameter.imageModificationBlock ;
279+ drawParameter = _drawParameter;
303280 }
304281
282+ CGRect drawParameterBounds = drawParameter.bounds ;
283+ BOOL forceUpscaling = drawParameter.forceUpscaling ;
284+ CGSize forcedSize = drawParameter.forcedSize ;
285+ BOOL cropEnabled = drawParameter.cropEnabled ;
286+ BOOL isOpaque = drawParameter.opaque ;
287+ UIColor *backgroundColor = drawParameter.backgroundColor ;
288+ UIViewContentMode contentMode = drawParameter.contentMode ;
289+ CGFloat contentsScale = drawParameter.contentsScale ;
290+ CGRect cropDisplayBounds = drawParameter.cropDisplayBounds ;
291+ CGRect cropRect = drawParameter.cropRect ;
292+ asimagenode_modification_block_t imageModificationBlock = drawParameter.imageModificationBlock ;
293+
305294 BOOL hasValidCropBounds = cropEnabled && !CGRectIsEmpty (cropDisplayBounds);
306295 CGRect bounds = (hasValidCropBounds ? cropDisplayBounds : drawParameterBounds);
307296
@@ -374,26 +363,26 @@ - (UIImage *)displayWithParameters:(id<NSObject> *)parameter isCancelled:(asdisp
374363 return nil ;
375364 }
376365
377- ASImageNodeContentsKey *contentsKey = [[ASImageNodeContentsKey alloc ] init ];
378- contentsKey.image = image;
379- contentsKey.backingSize = backingSize;
380- contentsKey.imageDrawRect = imageDrawRect;
381- contentsKey.isOpaque = isOpaque;
382- contentsKey.backgroundColor = backgroundColor;
383- contentsKey.preContextBlock = preContextBlock;
384- contentsKey.postContextBlock = postContextBlock;
385- contentsKey.imageModificationBlock = imageModificationBlock;
386-
387- if (isCancelled ()) {
388- return nil ;
389- }
366+ ASImageNodeContentsKey *contentsKey = [[ASImageNodeContentsKey alloc ] init ];
367+ contentsKey.image = image;
368+ contentsKey.backingSize = backingSize;
369+ contentsKey.imageDrawRect = imageDrawRect;
370+ contentsKey.isOpaque = isOpaque;
371+ contentsKey.backgroundColor = backgroundColor;
372+ contentsKey.preContextBlock = preContextBlock;
373+ contentsKey.postContextBlock = postContextBlock;
374+ contentsKey.imageModificationBlock = imageModificationBlock;
390375
391- ASWeakMapEntry<UIImage *> *entry = [self .class contentsForkey: contentsKey isCancelled: (asdisplaynode_iscancelled_block_t )isCancelled];
392- if (entry == nil ) { // If nil, we were cancelled.
393- return nil ;
394- }
395- _weakCacheEntry = entry; // Retain so that the entry remains in the weak cache
396- return entry.value ;
376+ if (isCancelled ()) {
377+ return nil ;
378+ }
379+
380+ ASWeakMapEntry<UIImage *> *entry = [self .class contentsForkey: contentsKey isCancelled: (asdisplaynode_iscancelled_block_t )isCancelled];
381+ if (entry == nil ) { // If nil, we were cancelled.
382+ return nil ;
383+ }
384+ _weakCacheEntry = entry; // Retain so that the entry remains in the weak cache
385+ return entry.value ;
397386}
398387
399388static ASWeakMap<ASImageNodeContentsKey *, UIImage *> *cache = nil ;
0 commit comments