297 :(
const SkRRect&)clipSkRRect matrix:(
const SkMatrix&)matrix {
298 CGPathRef pathRef =
nullptr;
299 switch (clipSkRRect.getType()) {
300 case SkRRect::kEmpty_Type: {
303 case SkRRect::kRect_Type: {
304 [
self clipRect:clipSkRRect.rect() matrix:matrix];
307 case SkRRect::kOval_Type:
308 case SkRRect::kSimple_Type: {
310 pathRef = CGPathCreateWithRoundedRect(clipRect, clipSkRRect.getSimpleRadii().x(),
311 clipSkRRect.getSimpleRadii().y(), nil);
314 case SkRRect::kNinePatch_Type:
315 case SkRRect::kComplex_Type: {
316 CGMutablePathRef mutablePathRef = CGPathCreateMutable();
318 SkRect clipSkRect = clipSkRRect.rect();
319 SkVector topLeftRadii = clipSkRRect.radii(SkRRect::kUpperLeft_Corner);
320 SkVector topRightRadii = clipSkRRect.radii(SkRRect::kUpperRight_Corner);
321 SkVector bottomRightRadii = clipSkRRect.radii(SkRRect::kLowerRight_Corner);
322 SkVector bottomLeftRadii = clipSkRRect.radii(SkRRect::kLowerLeft_Corner);
326 CGPathMoveToPoint(mutablePathRef, nil, clipSkRect.fLeft + topLeftRadii.x(), clipSkRect.fTop);
328 CGPathAddLineToPoint(mutablePathRef, nil, clipSkRect.fRight - topRightRadii.x(),
330 CGPathAddCurveToPoint(mutablePathRef, nil, clipSkRect.fRight, clipSkRect.fTop,
331 clipSkRect.fRight, clipSkRect.fTop + topRightRadii.y(),
332 clipSkRect.fRight, clipSkRect.fTop + topRightRadii.y());
334 CGPathAddLineToPoint(mutablePathRef, nil, clipSkRect.fRight,
335 clipSkRect.fBottom - bottomRightRadii.y());
336 CGPathAddCurveToPoint(mutablePathRef, nil, clipSkRect.fRight, clipSkRect.fBottom,
337 clipSkRect.fRight - bottomRightRadii.x(), clipSkRect.fBottom,
338 clipSkRect.fRight - bottomRightRadii.x(), clipSkRect.fBottom);
340 CGPathAddLineToPoint(mutablePathRef, nil, clipSkRect.fLeft + bottomLeftRadii.x(),
342 CGPathAddCurveToPoint(mutablePathRef, nil, clipSkRect.fLeft, clipSkRect.fBottom,
343 clipSkRect.fLeft, clipSkRect.fBottom - bottomLeftRadii.y(),
344 clipSkRect.fLeft, clipSkRect.fBottom - bottomLeftRadii.y());
346 CGPathAddLineToPoint(mutablePathRef, nil, clipSkRect.fLeft,
347 clipSkRect.fTop + topLeftRadii.y());
348 CGPathAddCurveToPoint(mutablePathRef, nil, clipSkRect.fLeft, clipSkRect.fTop,
349 clipSkRect.fLeft + topLeftRadii.x(), clipSkRect.fTop,
350 clipSkRect.fLeft + topLeftRadii.x(), clipSkRect.fTop);
351 CGPathCloseSubpath(mutablePathRef);
353 pathRef = mutablePathRef;
358 CATransform3D matrixInPoints =
363 [
self addTransformedPath:pathRef matrix:matrixInPoints];