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 <cmath> | 8 #include <cmath> |
9 #include "SkRRect.h" | 9 #include "SkRRect.h" |
10 #include "SkMatrix.h" | 10 #include "SkMatrix.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 // The sides of the rectangle may be larger than a float. | 173 // The sides of the rectangle may be larger than a float. |
174 double width = (double)fRect.fRight - (double)fRect.fLeft; | 174 double width = (double)fRect.fRight - (double)fRect.fLeft; |
175 double height = (double)fRect.fBottom - (double)fRect.fTop; | 175 double height = (double)fRect.fBottom - (double)fRect.fTop; |
176 scale = compute_min_scale(fRadii[0].fX, fRadii[1].fX, width, scale); | 176 scale = compute_min_scale(fRadii[0].fX, fRadii[1].fX, width, scale); |
177 scale = compute_min_scale(fRadii[1].fY, fRadii[2].fY, height, scale); | 177 scale = compute_min_scale(fRadii[1].fY, fRadii[2].fY, height, scale); |
178 scale = compute_min_scale(fRadii[2].fX, fRadii[3].fX, width, scale); | 178 scale = compute_min_scale(fRadii[2].fX, fRadii[3].fX, width, scale); |
179 scale = compute_min_scale(fRadii[3].fY, fRadii[0].fY, height, scale); | 179 scale = compute_min_scale(fRadii[3].fY, fRadii[0].fY, height, scale); |
180 | 180 |
181 if (scale < 1.0) { | 181 if (scale < 1.0) { |
182 ScaleToSides::AdjustRadii(width, scale, &fRadii[0].fX, &fRadii[1].fX); | 182 SkScaleToSides::AdjustRadii(width, scale, &fRadii[0].fX, &fRadii[1].fX)
; |
183 ScaleToSides::AdjustRadii(height, scale, &fRadii[1].fY, &fRadii[2].fY); | 183 SkScaleToSides::AdjustRadii(height, scale, &fRadii[1].fY, &fRadii[2].fY)
; |
184 ScaleToSides::AdjustRadii(width, scale, &fRadii[2].fX, &fRadii[3].fX); | 184 SkScaleToSides::AdjustRadii(width, scale, &fRadii[2].fX, &fRadii[3].fX)
; |
185 ScaleToSides::AdjustRadii(height, scale, &fRadii[3].fY, &fRadii[0].fY); | 185 SkScaleToSides::AdjustRadii(height, scale, &fRadii[3].fY, &fRadii[0].fY)
; |
186 } | 186 } |
187 | 187 |
188 // At this point we're either oval, simple, or complex (not empty or rect). | 188 // At this point we're either oval, simple, or complex (not empty or rect). |
189 this->computeType(); | 189 this->computeType(); |
190 | 190 |
191 SkDEBUGCODE(this->validate();) | 191 SkDEBUGCODE(this->validate();) |
192 } | 192 } |
193 | 193 |
194 // This method determines if a point known to be inside the RRect's bounds is | 194 // This method determines if a point known to be inside the RRect's bounds is |
195 // inside all the corners. | 195 // inside all the corners. |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 } | 564 } |
565 | 565 |
566 for (int i = 0; i < 4; ++i) { | 566 for (int i = 0; i < 4; ++i) { |
567 validate_radius_check_predicates(fRadii[i].fX, fRect.fLeft, fRect.fRight
); | 567 validate_radius_check_predicates(fRadii[i].fX, fRect.fLeft, fRect.fRight
); |
568 validate_radius_check_predicates(fRadii[i].fY, fRect.fTop, fRect.fBottom
); | 568 validate_radius_check_predicates(fRadii[i].fY, fRect.fTop, fRect.fBottom
); |
569 } | 569 } |
570 } | 570 } |
571 #endif // SK_DEBUG | 571 #endif // SK_DEBUG |
572 | 572 |
573 /////////////////////////////////////////////////////////////////////////////// | 573 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |