Skip to content

[TextControls] Replace UIGraphicsBeginImageContext with UIGraphicsImageRenderer in MDCTextControlGradientManager #10288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Do not merge this version into `stable`. # DO NOT CHANGE THIS FILE
snapshot_test_goldens/**/*.png filter=lfs diff=lfs merge=lfs -text # DO NOT EDIT THE LINE BELOW.
.gitattributes merge=gitattributes
snapshot_test_goldens/**/*.png filter=lfs diff=lfs merge=lfs -text
# .gitattributes merge=gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ - (CALayer *)layerCombiningHorizontalGradient:(CAGradientLayer *)horizontalGradi
return layer;
}

- (UIImage *)createImageWithLayer:(CALayer *)layer {
UIGraphicsBeginImageContext(layer.frame.size);
[layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;

//Replace deprecated UIGraphicsBeginImageContext with UIGraphicsImageRenderer in createImageWithLayer
- (UIImage *)createImageWithLayer:(CALayer *)layer{
UIGraphicsImageRenderer *render = [[UIGraphicsImageRenderer alloc] initWithSize:layer.frame.size];
UIImage *image = [render imageWithActions:^(UIGraphicsImageRendererContext *context){
[layer renderInContext:context.CGContext];
}];
return image;
}

- (CALayer *)createLayerWithImage:(UIImage *)image {
Expand Down