| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 SkPaint& SkPaint::operator=(const SkPaint& src) { | 111 SkPaint& SkPaint::operator=(const SkPaint& src) { |
| 112 if (this == &src) { | 112 if (this == &src) { |
| 113 return *this; | 113 return *this; |
| 114 } | 114 } |
| 115 | 115 |
| 116 #define COPY(field) field = src.field | 116 #define COPY(field) field = src.field |
| 117 #define REF_COPY(field) SkSafeUnref(field); field = SkSafeRef(src.field) | 117 #define REF_COPY(field) SkSafeUnref(field); field = SkSafeRef(src.field) |
| 118 | 118 |
| 119 SkASSERT(&src); | |
| 120 | |
| 121 REF_COPY(fTypeface); | 119 REF_COPY(fTypeface); |
| 122 REF_COPY(fPathEffect); | 120 REF_COPY(fPathEffect); |
| 123 REF_COPY(fShader); | 121 REF_COPY(fShader); |
| 124 REF_COPY(fXfermode); | 122 REF_COPY(fXfermode); |
| 125 REF_COPY(fMaskFilter); | 123 REF_COPY(fMaskFilter); |
| 126 REF_COPY(fColorFilter); | 124 REF_COPY(fColorFilter); |
| 127 REF_COPY(fRasterizer); | 125 REF_COPY(fRasterizer); |
| 128 REF_COPY(fLooper); | 126 REF_COPY(fLooper); |
| 129 REF_COPY(fImageFilter); | 127 REF_COPY(fImageFilter); |
| 130 REF_COPY(fAnnotation); | 128 REF_COPY(fAnnotation); |
| (...skipping 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 } | 2426 } |
| 2429 | 2427 |
| 2430 uint32_t SkPaint::getHash() const { | 2428 uint32_t SkPaint::getHash() const { |
| 2431 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2429 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, |
| 2432 // so fBitfields should be 10 pointers and 6 32-bit values from the start. | 2430 // so fBitfields should be 10 pointers and 6 32-bit values from the start. |
| 2433 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 *
sizeof(uint32_t), | 2431 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 *
sizeof(uint32_t), |
| 2434 SkPaint_notPackedTightly); | 2432 SkPaint_notPackedTightly); |
| 2435 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2433 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
| 2436 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2434 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
| 2437 } | 2435 } |
| OLD | NEW |