Skip to content
This repository was archived by the owner on Aug 14, 2019. It is now read-only.

Commit bccad24

Browse files
committed
Merge pull request #951 from tobiasoleary/remove_context_state_save_restore
Remove unneeded CGContext Save and Restore calls.
2 parents 4c05c28 + 5e9e368 commit bccad24

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

JSQMessagesViewController/Factories/JSQMessagesAvatarImageFactory.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,13 @@ + (UIImage *)jsq_imageWitInitials:(NSString *)initials
130130
UIGraphicsBeginImageContextWithOptions(frame.size, NO, [UIScreen mainScreen].scale);
131131
{
132132
CGContextRef context = UIGraphicsGetCurrentContext();
133-
CGContextSaveGState(context);
134133

135134
CGContextSetFillColorWithColor(context, backgroundColor.CGColor);
136135
CGContextFillRect(context, frame);
137136
[initials drawAtPoint:drawPoint withAttributes:attributes];
138137

139138
image = UIGraphicsGetImageFromCurrentImageContext();
140139

141-
CGContextRestoreGState(context);
142140
}
143141
UIGraphicsEndImageContext();
144142

@@ -156,7 +154,6 @@ + (UIImage *)jsq_circularImage:(UIImage *)image withDiameter:(NSUInteger)diamete
156154
UIGraphicsBeginImageContextWithOptions(frame.size, NO, [UIScreen mainScreen].scale);
157155
{
158156
CGContextRef context = UIGraphicsGetCurrentContext();
159-
CGContextSaveGState(context);
160157

161158
UIBezierPath *imgPath = [UIBezierPath bezierPathWithOvalInRect:frame];
162159
[imgPath addClip];
@@ -168,8 +165,7 @@ + (UIImage *)jsq_circularImage:(UIImage *)image withDiameter:(NSUInteger)diamete
168165
}
169166

170167
newImage = UIGraphicsGetImageFromCurrentImageContext();
171-
172-
CGContextRestoreGState(context);
168+
173169
}
174170
UIGraphicsEndImageContext();
175171

0 commit comments

Comments
 (0)