346 if (clipDlRRect.IsEmpty()) {
347 return;
348 }
else if (clipDlRRect.
IsRect()) {
349 [self clipRect:clipDlRRect.GetBounds() matrix:matrix];
350 return;
351 } else {
352 CGPathRef pathRef = nullptr;
354
357 auto radii = clipDlRRect.
GetRadii();
358 pathRef =
359 CGPathCreateWithRoundedRect(clipRect, radii.top_left.width, radii.top_left.height, nil);
360 } else {
361 CGMutablePathRef mutablePathRef = CGPathCreateMutable();
362
365 auto top = clipDlRect.
GetTop();
373
374
375
376
377
378
379 CGPathMoveToPoint(mutablePathRef, nil,
380 left + top_left.width, top);
381
382 CGPathAddLineToPoint(mutablePathRef, nil,
383 right - top_right.width, top);
384 CGPathAddCurveToPoint(mutablePathRef, nil,
385 right, top,
386 right, top + top_right.height,
387 right, top + top_right.height);
388
389 CGPathAddLineToPoint(mutablePathRef, nil,
390 right, bottom - bottom_right.height);
391 CGPathAddCurveToPoint(mutablePathRef, nil,
392 right, bottom,
393 right - bottom_right.width, bottom,
394 right - bottom_right.width, bottom);
395
396 CGPathAddLineToPoint(mutablePathRef, nil,
397 left + bottom_left.width, bottom);
398 CGPathAddCurveToPoint(mutablePathRef, nil,
399 left, bottom,
400 left, bottom - bottom_left.height,
401 left, bottom - bottom_left.height);
402
403 CGPathAddLineToPoint(mutablePathRef, nil,
404 left, top + top_left.height);
405 CGPathAddCurveToPoint(mutablePathRef, nil,
406 left, top,
407 left + top_left.width, top,
408 left + top_left.width, top);
409 CGPathCloseSubpath(mutablePathRef);
410 pathRef = mutablePathRef;
411 }
412
413 CATransform3D matrixInPoints =
415
416
417
418 paths_.push_back([self getTransformedPath:pathRef matrix:matrixInPoints]);
419 }
420}
constexpr bool IsRect() const
constexpr const RoundingRadii & GetRadii() const
constexpr const Rect & GetBounds() const
constexpr bool AreAllCornersSame(Scalar tolerance=kEhCloseEnough) const
constexpr auto GetBottom() const
constexpr auto GetTop() const
constexpr auto GetLeft() const
constexpr auto GetRight() const