| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 "SkPaint.h" | 8 #include "SkPaint.h" |
| 9 #include "SkAutoKern.h" | 9 #include "SkAutoKern.h" |
| 10 #include "SkChecksum.h" | 10 #include "SkChecksum.h" |
| (...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2018 this->getLooper()->computeFastBounds(*this, *src, storage); | 2018 this->getLooper()->computeFastBounds(*this, *src, storage); |
| 2019 return *storage; | 2019 return *storage; |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 SkRect tmpSrc; | 2022 SkRect tmpSrc; |
| 2023 if (this->getPathEffect()) { | 2023 if (this->getPathEffect()) { |
| 2024 this->getPathEffect()->computeFastBounds(&tmpSrc, origSrc); | 2024 this->getPathEffect()->computeFastBounds(&tmpSrc, origSrc); |
| 2025 src = &tmpSrc; | 2025 src = &tmpSrc; |
| 2026 } | 2026 } |
| 2027 | 2027 |
| 2028 if (kFill_Style != style) { | 2028 SkScalar radius = SkStrokeRec::GetInflationRadius(*this, style); |
| 2029 // since we're stroked, outset the rect by the radius (and join type) | 2029 *storage = src->makeOutset(radius, radius); |
| 2030 SkScalar radius = SkScalarHalf(this->getStrokeWidth()); | |
| 2031 if (0 == radius) { // hairline | |
| 2032 radius = SK_Scalar1; | |
| 2033 } else if (this->getStrokeJoin() == SkPaint::kMiter_Join) { | |
| 2034 SkScalar scale = this->getStrokeMiter(); | |
| 2035 if (scale > SK_Scalar1) { | |
| 2036 radius = SkScalarMul(radius, scale); | |
| 2037 } | |
| 2038 } | |
| 2039 storage->set(src->fLeft - radius, src->fTop - radius, | |
| 2040 src->fRight + radius, src->fBottom + radius); | |
| 2041 } else { | |
| 2042 *storage = *src; | |
| 2043 } | |
| 2044 | 2030 |
| 2045 if (this->getMaskFilter()) { | 2031 if (this->getMaskFilter()) { |
| 2046 this->getMaskFilter()->computeFastBounds(*storage, storage); | 2032 this->getMaskFilter()->computeFastBounds(*storage, storage); |
| 2047 } | 2033 } |
| 2048 | 2034 |
| 2049 if (this->getImageFilter()) { | 2035 if (this->getImageFilter()) { |
| 2050 *storage = this->getImageFilter()->computeFastBounds(*storage); | 2036 *storage = this->getImageFilter()->computeFastBounds(*storage); |
| 2051 } | 2037 } |
| 2052 | 2038 |
| 2053 return *storage; | 2039 return *storage; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 } | 2357 } |
| 2372 | 2358 |
| 2373 uint32_t SkPaint::getHash() const { | 2359 uint32_t SkPaint::getHash() const { |
| 2374 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2360 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, |
| 2375 // so fBitfields should be 10 pointers and 6 32-bit values from the start. | 2361 // so fBitfields should be 10 pointers and 6 32-bit values from the start. |
| 2376 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo
f(uint32_t), | 2362 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo
f(uint32_t), |
| 2377 "SkPaint_notPackedTightly"); | 2363 "SkPaint_notPackedTightly"); |
| 2378 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2364 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
| 2379 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2365 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
| 2380 } | 2366 } |
| OLD | NEW |