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