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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 if (flatFlags & kHasTypeface_FlatFlag) { | 1923 if (flatFlags & kHasTypeface_FlatFlag) { |
1924 this->setTypeface(buffer.readTypeface()); | 1924 this->setTypeface(buffer.readTypeface()); |
1925 } else { | 1925 } else { |
1926 this->setTypeface(nullptr); | 1926 this->setTypeface(nullptr); |
1927 } | 1927 } |
1928 | 1928 |
1929 if (flatFlags & kHasEffects_FlatFlag) { | 1929 if (flatFlags & kHasEffects_FlatFlag) { |
1930 this->setPathEffect(buffer.readPathEffect()); | 1930 this->setPathEffect(buffer.readPathEffect()); |
1931 this->setShader(buffer.readShader()); | 1931 this->setShader(buffer.readShader()); |
1932 this->setXfermode(buffer.readXfermode()); | 1932 this->setXfermode(buffer.readXfermode()); |
1933 SkSafeUnref(this->setMaskFilter(buffer.readMaskFilter())); | 1933 this->setMaskFilter(buffer.readMaskFilter()); |
1934 this->setColorFilter(buffer.readColorFilter()); | 1934 this->setColorFilter(buffer.readColorFilter()); |
1935 this->setRasterizer(buffer.readRasterizer()); | 1935 this->setRasterizer(buffer.readRasterizer()); |
1936 this->setLooper(buffer.readDrawLooper()); | 1936 this->setLooper(buffer.readDrawLooper()); |
1937 SkSafeUnref(this->setImageFilter(buffer.readImageFilter())); | 1937 this->setImageFilter(buffer.readImageFilter()); |
1938 | 1938 |
1939 if (buffer.isVersionLT(SkReadBuffer::kAnnotationsMovedToCanvas_Version))
{ | 1939 if (buffer.isVersionLT(SkReadBuffer::kAnnotationsMovedToCanvas_Version))
{ |
1940 // We used to store annotations here (string+skdata) if this bool wa
s true | 1940 // We used to store annotations here (string+skdata) if this bool wa
s true |
1941 if (buffer.readBool()) { | 1941 if (buffer.readBool()) { |
1942 // Annotations have moved to drawAnnotation, so we just drop thi
s one on the floor. | 1942 // Annotations have moved to drawAnnotation, so we just drop thi
s one on the floor. |
1943 SkString key; | 1943 SkString key; |
1944 buffer.readString(&key); | 1944 buffer.readString(&key); |
1945 (void)buffer.readByteArrayAsData(); | 1945 (void)buffer.readByteArrayAsData(); |
1946 } | 1946 } |
1947 } | 1947 } |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2357 } | 2357 } |
2358 | 2358 |
2359 uint32_t SkPaint::getHash() const { | 2359 uint32_t SkPaint::getHash() const { |
2360 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2360 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, |
2361 // so fBitfields should be 10 pointers and 6 32-bit values from the start. | 2361 // so fBitfields should be 10 pointers and 6 32-bit values from the start. |
2362 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo
f(uint32_t), | 2362 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo
f(uint32_t), |
2363 "SkPaint_notPackedTightly"); | 2363 "SkPaint_notPackedTightly"); |
2364 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2364 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
2365 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2365 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
2366 } | 2366 } |
OLD | NEW |