OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkAnnotation.h" | 10 #include "SkAnnotation.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 memcpy(this, &src, sizeof(src)); | 154 memcpy(this, &src, sizeof(src)); |
155 #ifdef SK_BUILD_FOR_ANDROID | 155 #ifdef SK_BUILD_FOR_ANDROID |
156 fGenerationID = oldGenerationID + 1; | 156 fGenerationID = oldGenerationID + 1; |
157 | 157 |
158 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid); | 158 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid); |
159 #endif | 159 #endif |
160 | 160 |
161 return *this; | 161 return *this; |
162 } | 162 } |
163 | 163 |
164 bool operator==(const SkPaint& a, const SkPaint& b) { | |
165 #ifdef SK_BUILD_FOR_ANDROID | |
166 //assumes that fGenerationID is the last field in the struct | |
167 return !memcmp(&a, &b, SK_OFFSETOF(SkPaint, fGenerationID)); | |
168 #else | |
169 return !memcmp(&a, &b, sizeof(a)); | |
170 #endif | |
171 } | |
172 | |
173 void SkPaint::reset() { | 164 void SkPaint::reset() { |
174 SkPaint init; | 165 SkPaint init; |
175 | 166 |
176 #ifdef SK_BUILD_FOR_ANDROID | 167 #ifdef SK_BUILD_FOR_ANDROID |
177 uint32_t oldGenerationID = fGenerationID; | 168 uint32_t oldGenerationID = fGenerationID; |
178 #endif | 169 #endif |
179 *this = init; | 170 *this = init; |
180 #ifdef SK_BUILD_FOR_ANDROID | 171 #ifdef SK_BUILD_FOR_ANDROID |
181 fGenerationID = oldGenerationID + 1; | 172 fGenerationID = oldGenerationID + 1; |
182 #endif | 173 #endif |
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 case SkXfermode::kPlus_Mode: | 2593 case SkXfermode::kPlus_Mode: |
2603 return 0 == this->getAlpha(); | 2594 return 0 == this->getAlpha(); |
2604 case SkXfermode::kDst_Mode: | 2595 case SkXfermode::kDst_Mode: |
2605 return true; | 2596 return true; |
2606 default: | 2597 default: |
2607 break; | 2598 break; |
2608 } | 2599 } |
2609 } | 2600 } |
2610 return false; | 2601 return false; |
2611 } | 2602 } |
OLD | NEW |