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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 SkASSERT(sizeof(storage) == kSizeInMemory); | 429 SkASSERT(sizeof(storage) == kSizeInMemory); |
430 | 430 |
431 // we make a local copy, to ensure alignment before we cast | 431 // we make a local copy, to ensure alignment before we cast |
432 memcpy(storage, buffer, kSizeInMemory); | 432 memcpy(storage, buffer, kSizeInMemory); |
433 | 433 |
434 this->setRectRadii(*(const SkRect*)&storage[0], | 434 this->setRectRadii(*(const SkRect*)&storage[0], |
435 (const SkVector*)&storage[4]); | 435 (const SkVector*)&storage[4]); |
436 return kSizeInMemory; | 436 return kSizeInMemory; |
437 } | 437 } |
438 | 438 |
| 439 #ifdef SK_DEVELOPER |
| 440 void SkRRect::dump() const { |
| 441 SkDebugf("Rect: "); |
| 442 fRect.dump(); |
| 443 SkDebugf(" Corners: { TL: (%f, %f), TR: (%f, %f), BR: (%f, %f), BL: (%f, %f)
}", |
| 444 fRadii[kUpperLeft_Corner].fX, fRadii[kUpperLeft_Corner].fY, |
| 445 fRadii[kUpperRight_Corner].fX, fRadii[kUpperRight_Corner].fY, |
| 446 fRadii[kLowerRight_Corner].fX, fRadii[kLowerRight_Corner].fY, |
| 447 fRadii[kLowerLeft_Corner].fX, fRadii[kLowerLeft_Corner].fY); |
| 448 } |
| 449 #endif |
| 450 |
439 /////////////////////////////////////////////////////////////////////////////// | 451 /////////////////////////////////////////////////////////////////////////////// |
440 | 452 |
441 #ifdef SK_DEBUG | 453 #ifdef SK_DEBUG |
442 void SkRRect::validate() const { | 454 void SkRRect::validate() const { |
443 bool allRadiiZero = (0 == fRadii[0].fX && 0 == fRadii[0].fY); | 455 bool allRadiiZero = (0 == fRadii[0].fX && 0 == fRadii[0].fY); |
444 bool allCornersSquare = (0 == fRadii[0].fX || 0 == fRadii[0].fY); | 456 bool allCornersSquare = (0 == fRadii[0].fX || 0 == fRadii[0].fY); |
445 bool allRadiiSame = true; | 457 bool allRadiiSame = true; |
446 | 458 |
447 for (int i = 1; i < 4; ++i) { | 459 for (int i = 1; i < 4; ++i) { |
448 if (0 != fRadii[i].fX || 0 != fRadii[i].fY) { | 460 if (0 != fRadii[i].fX || 0 != fRadii[i].fY) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 SkASSERT(!patchesOfNine); | 504 SkASSERT(!patchesOfNine); |
493 break; | 505 break; |
494 case kUnknown_Type: | 506 case kUnknown_Type: |
495 // no limits on this | 507 // no limits on this |
496 break; | 508 break; |
497 } | 509 } |
498 } | 510 } |
499 #endif // SK_DEBUG | 511 #endif // SK_DEBUG |
500 | 512 |
501 /////////////////////////////////////////////////////////////////////////////// | 513 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |