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 "SkAnnotation.h" | 9 #include "SkAnnotation.h" |
10 #include "SkAutoKern.h" | 10 #include "SkAutoKern.h" |
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 // since we know we're just going to delete tmpPath when we return, | 2056 // since we know we're just going to delete tmpPath when we return, |
2057 // so the swap saves that copy. | 2057 // so the swap saves that copy. |
2058 dst->swap(tmpPath); | 2058 dst->swap(tmpPath); |
2059 } else { | 2059 } else { |
2060 *dst = *srcPtr; | 2060 *dst = *srcPtr; |
2061 } | 2061 } |
2062 } | 2062 } |
2063 return !rec.isHairlineStyle(); | 2063 return !rec.isHairlineStyle(); |
2064 } | 2064 } |
2065 | 2065 |
2066 bool SkPaint::canComputeFastBounds() const { | |
2067 if (this->getLooper()) { | |
2068 return this->getLooper()->canComputeFastBounds(*this); | |
2069 } | |
2070 if (this->getImageFilter() && !this->getImageFilter()->canComputeFastBounds(
)) { | |
2071 return false; | |
2072 } | |
2073 return !this->getRasterizer(); | |
2074 } | |
2075 | |
2076 const SkRect& SkPaint::doComputeFastBounds(const SkRect& origSrc, | 2066 const SkRect& SkPaint::doComputeFastBounds(const SkRect& origSrc, |
2077 SkRect* storage, | 2067 SkRect* storage, |
2078 Style style) const { | 2068 Style style) const { |
2079 SkASSERT(storage); | 2069 SkASSERT(storage); |
2080 | 2070 |
2081 const SkRect* src = &origSrc; | 2071 const SkRect* src = &origSrc; |
2082 | 2072 |
2083 if (this->getLooper()) { | 2073 if (this->getLooper()) { |
2084 SkASSERT(this->getLooper()->canComputeFastBounds(*this)); | 2074 SkASSERT(this->getLooper()->canComputeFastBounds(*this)); |
2085 this->getLooper()->computeFastBounds(*this, *src, storage); | 2075 this->getLooper()->computeFastBounds(*this, *src, storage); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2427 } | 2417 } |
2428 | 2418 |
2429 uint32_t SkPaint::getHash() const { | 2419 uint32_t SkPaint::getHash() const { |
2430 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2420 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, |
2431 // so fBitfields should be 10 pointers and 6 32-bit values from the start. | 2421 // so fBitfields should be 10 pointers and 6 32-bit values from the start. |
2432 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 *
sizeof(uint32_t), | 2422 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 *
sizeof(uint32_t), |
2433 SkPaint_notPackedTightly); | 2423 SkPaint_notPackedTightly); |
2434 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2424 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
2435 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2425 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
2436 } | 2426 } |
OLD | NEW |