| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 scale = compute_min_scale(fRadii[2].fX, fRadii[3].fX, fRect.width(), scale)
; | 195 scale = compute_min_scale(fRadii[2].fX, fRadii[3].fX, fRect.width(), scale)
; |
| 196 scale = compute_min_scale(fRadii[3].fY, fRadii[0].fY, fRect.height(), scale)
; | 196 scale = compute_min_scale(fRadii[3].fY, fRadii[0].fY, fRect.height(), scale)
; |
| 197 | 197 |
| 198 if (scale < 1.0) { | 198 if (scale < 1.0) { |
| 199 for (int i = 0; i < 4; ++i) { | 199 for (int i = 0; i < 4; ++i) { |
| 200 fRadii[i].fX *= scale; | 200 fRadii[i].fX *= scale; |
| 201 fRadii[i].fY *= scale; | 201 fRadii[i].fY *= scale; |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 // skbug.com/3239 -- its possible that we can hit the following inconsistenc
y: | 205 // https://bug.skia.org/3239 -- its possible that we can hit the following i
nconsistency: |
| 206 // rad == bounds.bottom - bounds.top | 206 // rad == bounds.bottom - bounds.top |
| 207 // bounds.bottom - radius < bounds.top | 207 // bounds.bottom - radius < bounds.top |
| 208 // YIKES | 208 // YIKES |
| 209 // We need to detect and "fix" this now, otherwise we can have the following
wackiness: | 209 // We need to detect and "fix" this now, otherwise we can have the following
wackiness: |
| 210 // path.addRRect(rrect); | 210 // path.addRRect(rrect); |
| 211 // rrect.rect() != path.getBounds() | 211 // rrect.rect() != path.getBounds() |
| 212 for (int i = 0; i < 4; ++i) { | 212 for (int i = 0; i < 4; ++i) { |
| 213 fRadii[i].fX = clamp_radius_check_predicates(fRadii[i].fX, fRect.fLeft,
fRect.fRight); | 213 fRadii[i].fX = clamp_radius_check_predicates(fRadii[i].fX, fRect.fLeft,
fRect.fRight); |
| 214 fRadii[i].fY = clamp_radius_check_predicates(fRadii[i].fY, fRect.fTop, f
Rect.fBottom); | 214 fRadii[i].fY = clamp_radius_check_predicates(fRadii[i].fY, fRect.fTop, f
Rect.fBottom); |
| 215 } | 215 } |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 } | 592 } |
| 593 | 593 |
| 594 for (int i = 0; i < 4; ++i) { | 594 for (int i = 0; i < 4; ++i) { |
| 595 validate_radius_check_predicates(fRadii[i].fX, fRect.fLeft, fRect.fRight
); | 595 validate_radius_check_predicates(fRadii[i].fX, fRect.fLeft, fRect.fRight
); |
| 596 validate_radius_check_predicates(fRadii[i].fY, fRect.fTop, fRect.fBottom
); | 596 validate_radius_check_predicates(fRadii[i].fY, fRect.fTop, fRect.fBottom
); |
| 597 } | 597 } |
| 598 } | 598 } |
| 599 #endif // SK_DEBUG | 599 #endif // SK_DEBUG |
| 600 | 600 |
| 601 /////////////////////////////////////////////////////////////////////////////// | 601 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |