OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkRRect.h" | 8 #include "SkRRect.h" |
9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
10 | 10 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 446 } |
447 | 447 |
448 SkDEBUGCODE(dst->validate();) | 448 SkDEBUGCODE(dst->validate();) |
449 | 449 |
450 return true; | 450 return true; |
451 } | 451 } |
452 | 452 |
453 /////////////////////////////////////////////////////////////////////////////// | 453 /////////////////////////////////////////////////////////////////////////////// |
454 | 454 |
455 void SkRRect::inset(SkScalar dx, SkScalar dy, SkRRect* dst) const { | 455 void SkRRect::inset(SkScalar dx, SkScalar dy, SkRRect* dst) const { |
456 SkRect r = fRect; | 456 const SkRect r = fRect.makeInset(dx, dy); |
457 | 457 |
458 r.inset(dx, dy); | |
459 if (r.isEmpty()) { | 458 if (r.isEmpty()) { |
460 dst->setEmpty(); | 459 dst->setEmpty(); |
461 return; | 460 return; |
462 } | 461 } |
463 | 462 |
464 SkVector radii[4]; | 463 SkVector radii[4]; |
465 memcpy(radii, fRadii, sizeof(radii)); | 464 memcpy(radii, fRadii, sizeof(radii)); |
466 for (int i = 0; i < 4; ++i) { | 465 for (int i = 0; i < 4; ++i) { |
467 if (radii[i].fX) { | 466 if (radii[i].fX) { |
468 radii[i].fX -= dx; | 467 radii[i].fX -= dx; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 } | 589 } |
591 | 590 |
592 for (int i = 0; i < 4; ++i) { | 591 for (int i = 0; i < 4; ++i) { |
593 validate_radius_check_predicates(fRadii[i].fX, fRect.fLeft, fRect.fRight
); | 592 validate_radius_check_predicates(fRadii[i].fX, fRect.fLeft, fRect.fRight
); |
594 validate_radius_check_predicates(fRadii[i].fY, fRect.fTop, fRect.fBottom
); | 593 validate_radius_check_predicates(fRadii[i].fY, fRect.fTop, fRect.fBottom
); |
595 } | 594 } |
596 } | 595 } |
597 #endif // SK_DEBUG | 596 #endif // SK_DEBUG |
598 | 597 |
599 /////////////////////////////////////////////////////////////////////////////// | 598 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |