301 :(
const SkRRect&)clipSkRRect matrix:(
const SkMatrix&)matrix {
303 CGPathRef pathRef =
nullptr;
304 switch (clipSkRRect.getType()) {
305 case SkRRect::kEmpty_Type: {
308 case SkRRect::kRect_Type: {
309 [
self clipRect:clipSkRRect.rect() matrix:matrix];
312 case SkRRect::kOval_Type:
313 case SkRRect::kSimple_Type: {
314 CGRect clipRect = GetCGRectFromSkRect(clipSkRRect.rect());
315 pathRef = CGPathCreateWithRoundedRect(clipRect, clipSkRRect.getSimpleRadii().x(),
316 clipSkRRect.getSimpleRadii().y(), nil);
319 case SkRRect::kNinePatch_Type:
320 case SkRRect::kComplex_Type: {
321 CGMutablePathRef mutablePathRef = CGPathCreateMutable();
323 SkRect clipSkRect = clipSkRRect.rect();
324 SkVector topLeftRadii = clipSkRRect.radii(SkRRect::kUpperLeft_Corner);
325 SkVector topRightRadii = clipSkRRect.radii(SkRRect::kUpperRight_Corner);
326 SkVector bottomRightRadii = clipSkRRect.radii(SkRRect::kLowerRight_Corner);
327 SkVector bottomLeftRadii = clipSkRRect.radii(SkRRect::kLowerLeft_Corner);
331 CGPathMoveToPoint(mutablePathRef, nil, clipSkRect.fLeft + topLeftRadii.x(), clipSkRect.fTop);
333 CGPathAddLineToPoint(mutablePathRef, nil, clipSkRect.fRight - topRightRadii.x(),
335 CGPathAddCurveToPoint(mutablePathRef, nil, clipSkRect.fRight, clipSkRect.fTop,
336 clipSkRect.fRight, clipSkRect.fTop + topRightRadii.y(),
337 clipSkRect.fRight, clipSkRect.fTop + topRightRadii.y());
339 CGPathAddLineToPoint(mutablePathRef, nil, clipSkRect.fRight,
340 clipSkRect.fBottom - bottomRightRadii.y());
341 CGPathAddCurveToPoint(mutablePathRef, nil, clipSkRect.fRight, clipSkRect.fBottom,
342 clipSkRect.fRight - bottomRightRadii.x(), clipSkRect.fBottom,
343 clipSkRect.fRight - bottomRightRadii.x(), clipSkRect.fBottom);
345 CGPathAddLineToPoint(mutablePathRef, nil, clipSkRect.fLeft + bottomLeftRadii.x(),
347 CGPathAddCurveToPoint(mutablePathRef, nil, clipSkRect.fLeft, clipSkRect.fBottom,
348 clipSkRect.fLeft, clipSkRect.fBottom - bottomLeftRadii.y(),
349 clipSkRect.fLeft, clipSkRect.fBottom - bottomLeftRadii.y());
351 CGPathAddLineToPoint(mutablePathRef, nil, clipSkRect.fLeft,
352 clipSkRect.fTop + topLeftRadii.y());
353 CGPathAddCurveToPoint(mutablePathRef, nil, clipSkRect.fLeft, clipSkRect.fTop,
354 clipSkRect.fLeft + topLeftRadii.x(), clipSkRect.fTop,
355 clipSkRect.fLeft + topLeftRadii.x(), clipSkRect.fTop);
356 CGPathCloseSubpath(mutablePathRef);
358 pathRef = mutablePathRef;
363 CATransform3D matrixInPoints =
364 CATransform3DConcat(GetCATransform3DFromSkMatrix(matrix), _reverseScreenScale);
368 paths_.push_back([
self getTransformedPath:pathRef matrix:matrixInPoints]);