@@ -55,11 +55,10 @@ + (CGRect)getCGRectFromSkRect:(const SkRect&)clipSkRect {
5555
5656- (void )clipRect : (const SkRect&)clipSkRect {
5757 CGRect clipRect = [ChildClippingView getCGRectFromSkRect: clipSkRect];
58- CGPathRef pathRef = CGPathCreateWithRect (clipRect, nil );
59- CAShapeLayer * clip = [[CAShapeLayer alloc ] init ];
58+ fml::CFRef< CGPathRef> pathRef ( CGPathCreateWithRect (clipRect, nil ) );
59+ CAShapeLayer * clip = [[[ CAShapeLayer alloc ] init ] autorelease ];
6060 clip.path = pathRef;
6161 self.layer .mask = clip;
62- CGPathRelease (pathRef);
6362}
6463
6564- (void )clipRRect : (const SkRRect&)clipSkRRect {
@@ -125,7 +124,7 @@ - (void)clipRRect:(const SkRRect&)clipSkRRect {
125124 // TODO(cyanglaz): iOS does not seem to support hard edge on CAShapeLayer. It clearly stated that
126125 // the CAShaperLayer will be drawn antialiased. Need to figure out a way to do the hard edge
127126 // clipping on iOS.
128- CAShapeLayer * clip = [[CAShapeLayer alloc ] init ];
127+ CAShapeLayer * clip = [[[ CAShapeLayer alloc ] init ] autorelease ];
129128 clip.path = pathRef;
130129 self.layer .mask = clip;
131130 CGPathRelease (pathRef);
@@ -137,7 +136,7 @@ - (void)clipPath:(const SkPath&)path {
137136 return ;
138137 }
139138 if (path.isEmpty ()) {
140- CAShapeLayer * clip = [[CAShapeLayer alloc ] init ];
139+ CAShapeLayer * clip = [[[ CAShapeLayer alloc ] init ] autorelease ];
141140 clip.path = pathRef;
142141 self.layer .mask = clip;
143142 CGPathRelease (pathRef);
@@ -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 CGPathRelease (pathRef);
0 commit comments