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::GetInflationBounds(*this); |
bsalomon
2016/04/28 20:39:01
Just noticed this uses the passed in style var rat
bsalomon
2016/04/28 20:49:29
Ok, fixed that.
| |
2029 // since we're stroked, outset the rect by the radius (and join type) | 2029 storage->set(src->fLeft - radius, src->fTop - radius, |
2030 SkScalar radius = SkScalarHalf(this->getStrokeWidth()); | 2030 src->fRight + radius, src->fBottom + radius); |
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 | 2031 |
2045 if (this->getMaskFilter()) { | 2032 if (this->getMaskFilter()) { |
2046 this->getMaskFilter()->computeFastBounds(*storage, storage); | 2033 this->getMaskFilter()->computeFastBounds(*storage, storage); |
2047 } | 2034 } |
2048 | 2035 |
2049 if (this->getImageFilter()) { | 2036 if (this->getImageFilter()) { |
2050 *storage = this->getImageFilter()->computeFastBounds(*storage); | 2037 *storage = this->getImageFilter()->computeFastBounds(*storage); |
2051 } | 2038 } |
2052 | 2039 |
2053 return *storage; | 2040 return *storage; |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2371 } | 2358 } |
2372 | 2359 |
2373 uint32_t SkPaint::getHash() const { | 2360 uint32_t SkPaint::getHash() const { |
2374 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields, | 2361 // 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. | 2362 // 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), | 2363 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo f(uint32_t), |
2377 "SkPaint_notPackedTightly"); | 2364 "SkPaint_notPackedTightly"); |
2378 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2365 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
2379 offsetof(SkPaint, fBitfields) + sizeof(fBitfields )); | 2366 offsetof(SkPaint, fBitfields) + sizeof(fBitfields )); |
2380 } | 2367 } |
OLD | NEW |