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