@@ -55,11 +55,10 @@ + (CGRect)getCGRectFromSkRect:(const SkRect&)clipSkRect {
55
55
56
56
- (void )clipRect : (const SkRect&)clipSkRect {
57
57
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 ];
60
60
clip.path = pathRef;
61
61
self.layer .mask = clip;
62
- CGPathRelease (pathRef);
63
62
}
64
63
65
64
- (void )clipRRect : (const SkRRect&)clipSkRRect {
@@ -125,7 +124,7 @@ - (void)clipRRect:(const SkRRect&)clipSkRRect {
125
124
// TODO(cyanglaz): iOS does not seem to support hard edge on CAShapeLayer. It clearly stated that
126
125
// the CAShaperLayer will be drawn antialiased. Need to figure out a way to do the hard edge
127
126
// clipping on iOS.
128
- CAShapeLayer * clip = [[CAShapeLayer alloc ] init ];
127
+ CAShapeLayer * clip = [[[ CAShapeLayer alloc ] init ] autorelease ];
129
128
clip.path = pathRef;
130
129
self.layer .mask = clip;
131
130
CGPathRelease (pathRef);
@@ -137,7 +136,7 @@ - (void)clipPath:(const SkPath&)path {
137
136
return ;
138
137
}
139
138
if (path.isEmpty ()) {
140
- CAShapeLayer * clip = [[CAShapeLayer alloc ] init ];
139
+ CAShapeLayer * clip = [[[ CAShapeLayer alloc ] init ] autorelease ];
141
140
clip.path = pathRef;
142
141
self.layer .mask = clip;
143
142
CGPathRelease (pathRef);
@@ -195,7 +194,7 @@ - (void)clipPath:(const SkPath&)path {
195
194
verb = iter.next (pts);
196
195
}
197
196
198
- CAShapeLayer * clip = [[CAShapeLayer alloc ] init ];
197
+ CAShapeLayer * clip = [[[ CAShapeLayer alloc ] init ] autorelease ];
199
198
clip.path = pathRef;
200
199
self.layer .mask = clip;
201
200
CGPathRelease (pathRef);
0 commit comments