@@ -56,11 +56,10 @@ + (CGRect)getCGRectFromSkRect:(const SkRect&)clipSkRect {
5656
5757- (void )clipRect : (const SkRect&)clipSkRect {
5858 CGRect clipRect = [ChildClippingView getCGRectFromSkRect: clipSkRect];
59- CGPathRef pathRef = CGPathCreateWithRect (clipRect, nil );
60- CAShapeLayer * clip = [[CAShapeLayer alloc ] init ];
59+ fml::CFRef< CGPathRef> pathRef ( CGPathCreateWithRect (clipRect, nil ) );
60+ CAShapeLayer * clip = [[[ CAShapeLayer alloc ] init ] autorelease ];
6161 clip.path = pathRef;
6262 self.layer .mask = clip;
63- CGPathRelease (pathRef);
6463}
6564
6665- (void )clipRRect : (const SkRRect&)clipSkRRect {
@@ -126,7 +125,7 @@ - (void)clipRRect:(const SkRRect&)clipSkRRect {
126125 // TODO(cyanglaz): iOS does not seem to support hard edge on CAShapeLayer. It clearly stated that
127126 // the CAShaperLayer will be drawn antialiased. Need to figure out a way to do the hard edge
128127 // clipping on iOS.
129- CAShapeLayer * clip = [[CAShapeLayer alloc ] init ];
128+ CAShapeLayer * clip = [[[ CAShapeLayer alloc ] init ] autorelease ];
130129 clip.path = pathRef;
131130 self.layer .mask = clip;
132131 CGPathRelease (pathRef);
@@ -138,7 +137,7 @@ - (void)clipPath:(const SkPath&)path {
138137 }
139138 fml::CFRef<CGMutablePathRef> pathRef (CGPathCreateMutable ());
140139 if (path.isEmpty ()) {
141- CAShapeLayer * clip = [[CAShapeLayer alloc ] init ];
140+ CAShapeLayer * clip = [[[ CAShapeLayer alloc ] init ] autorelease ];
142141 clip.path = pathRef;
143142 self.layer .mask = clip;
144143 return ;
@@ -195,7 +194,7 @@ - (void)clipPath:(const SkPath&)path {
195194 verb = iter.next (pts);
196195 }
197196
198- CAShapeLayer * clip = [[CAShapeLayer alloc ] init ];
197+ CAShapeLayer * clip = [[[ CAShapeLayer alloc ] init ] autorelease ];
199198 clip.path = pathRef;
200199 self.layer .mask = clip;
201200}
0 commit comments