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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 Sk##Field* SkPaint::set##Field(Sk##Field* f) { \ | 368 Sk##Field* SkPaint::set##Field(Sk##Field* f) { \ |
369 this->f##Field.reset(SkSafeRef(f)); \ | 369 this->f##Field.reset(SkSafeRef(f)); \ |
370 return f; \ | 370 return f; \ |
371 } | 371 } |
372 SET_PTR(Typeface) | 372 SET_PTR(Typeface) |
373 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR | 373 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR |
374 SET_PTR(Rasterizer) | 374 SET_PTR(Rasterizer) |
375 #endif | 375 #endif |
376 SET_PTR(ImageFilter) | 376 SET_PTR(ImageFilter) |
377 SET_PTR(Shader) | 377 SET_PTR(Shader) |
| 378 #ifdef SK_SUPPORT_LEGACY_COLORFILTER_PTR |
378 SET_PTR(ColorFilter) | 379 SET_PTR(ColorFilter) |
| 380 #endif |
379 SET_PTR(Xfermode) | 381 SET_PTR(Xfermode) |
380 #ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR | 382 #ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR |
381 SET_PTR(PathEffect) | 383 SET_PTR(PathEffect) |
382 #endif | 384 #endif |
383 SET_PTR(MaskFilter) | 385 SET_PTR(MaskFilter) |
384 #undef SET_PTR | 386 #undef SET_PTR |
385 | 387 |
386 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR | 388 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR |
387 SkDrawLooper* SkPaint::setLooper(SkDrawLooper* looper) { | 389 SkDrawLooper* SkPaint::setLooper(SkDrawLooper* looper) { |
388 fLooper.reset(SkSafeRef(looper)); | 390 fLooper.reset(SkSafeRef(looper)); |
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 this->setTypeface(buffer.readTypeface()); | 1935 this->setTypeface(buffer.readTypeface()); |
1934 } else { | 1936 } else { |
1935 this->setTypeface(nullptr); | 1937 this->setTypeface(nullptr); |
1936 } | 1938 } |
1937 | 1939 |
1938 if (flatFlags & kHasEffects_FlatFlag) { | 1940 if (flatFlags & kHasEffects_FlatFlag) { |
1939 this->setPathEffect(buffer.readPathEffect()); | 1941 this->setPathEffect(buffer.readPathEffect()); |
1940 this->setShader(buffer.readShader()); | 1942 this->setShader(buffer.readShader()); |
1941 SkSafeUnref(this->setXfermode(buffer.readXfermode())); | 1943 SkSafeUnref(this->setXfermode(buffer.readXfermode())); |
1942 SkSafeUnref(this->setMaskFilter(buffer.readMaskFilter())); | 1944 SkSafeUnref(this->setMaskFilter(buffer.readMaskFilter())); |
1943 SkSafeUnref(this->setColorFilter(buffer.readColorFilter())); | 1945 this->setColorFilter(buffer.readColorFilter()); |
1944 this->setRasterizer(buffer.readRasterizer()); | 1946 this->setRasterizer(buffer.readRasterizer()); |
1945 this->setLooper(buffer.readDrawLooper()); | 1947 this->setLooper(buffer.readDrawLooper()); |
1946 SkSafeUnref(this->setImageFilter(buffer.readImageFilter())); | 1948 SkSafeUnref(this->setImageFilter(buffer.readImageFilter())); |
1947 | 1949 |
1948 if (buffer.isVersionLT(SkReadBuffer::kAnnotationsMovedToCanvas_Version))
{ | 1950 if (buffer.isVersionLT(SkReadBuffer::kAnnotationsMovedToCanvas_Version))
{ |
1949 // We used to store annotations here (string+skdata) if this bool wa
s true | 1951 // We used to store annotations here (string+skdata) if this bool wa
s true |
1950 if (buffer.readBool()) { | 1952 if (buffer.readBool()) { |
1951 // Annotations have moved to drawAnnotation, so we just drop thi
s one on the floor. | 1953 // Annotations have moved to drawAnnotation, so we just drop thi
s one on the floor. |
1952 SkString key; | 1954 SkString key; |
1953 buffer.readString(&key); | 1955 buffer.readString(&key); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2366 } | 2368 } |
2367 | 2369 |
2368 uint32_t SkPaint::getHash() const { | 2370 uint32_t SkPaint::getHash() const { |
2369 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2371 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, |
2370 // so fBitfields should be 10 pointers and 6 32-bit values from the start. | 2372 // so fBitfields should be 10 pointers and 6 32-bit values from the start. |
2371 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo
f(uint32_t), | 2373 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo
f(uint32_t), |
2372 "SkPaint_notPackedTightly"); | 2374 "SkPaint_notPackedTightly"); |
2373 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2375 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
2374 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2376 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
2375 } | 2377 } |
OLD | NEW |