Skip to content

Commit

Permalink
Revert "perf(ios): use new API for rendering view to image"
Browse files Browse the repository at this point in the history
This reverts commit c7e65a5.
  • Loading branch information
hansemannn authored and sgtcoolguy committed Apr 7, 2021
1 parent c08379b commit 91c00ba
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,6 @@ - (TiBlob *)toImage:(id)args
}
TiUIView *myview = [self view];
CGSize size = myview.bounds.size;
CGRect bounds = myview.bounds;
if (CGSizeEqualToSize(size, CGSizeZero) || size.width == 0 || size.height == 0) {
#ifndef TI_USE_AUTOLAYOUT
CGFloat width = [self autoWidthForSize:CGSizeMake(1000, 1000)];
Expand All @@ -719,14 +718,12 @@ - (TiBlob *)toImage:(id)args
}
CGRect rect = CGRectMake(0, 0, size.width, size.height);
[TiUtils setView:myview positionRect:rect];
bounds = rect;
}
if (!viewIsAttached) {
[self layoutChildren:NO];
}

UIGraphicsBeginImageContextWithOptions(size, [myview.layer isOpaque], (honorScale ? 0.0 : 1.0));
[myview drawViewHierarchyInRect:bounds afterScreenUpdates:YES];
[myview.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
blob = [[[TiBlob alloc] initWithImage:image] autorelease];
[blob setMimeType:@"image/png" type:TiBlobTypeImage];
Expand Down

0 comments on commit 91c00ba

Please sign in to comment.