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 "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 | 1951 |
1952 unsigned flatFlags = unpack_paint_flags(this, buffer.readUInt()); | 1952 unsigned flatFlags = unpack_paint_flags(this, buffer.readUInt()); |
1953 | 1953 |
1954 uint32_t tmp = buffer.readUInt(); | 1954 uint32_t tmp = buffer.readUInt(); |
1955 this->setStrokeCap(static_cast<Cap>((tmp >> 24) & 0xFF)); | 1955 this->setStrokeCap(static_cast<Cap>((tmp >> 24) & 0xFF)); |
1956 this->setStrokeJoin(static_cast<Join>((tmp >> 16) & 0xFF)); | 1956 this->setStrokeJoin(static_cast<Join>((tmp >> 16) & 0xFF)); |
1957 this->setStyle(static_cast<Style>((tmp >> 8) & 0xFF)); | 1957 this->setStyle(static_cast<Style>((tmp >> 8) & 0xFF)); |
1958 this->setTextEncoding(static_cast<TextEncoding>((tmp >> 0) & 0xFF)); | 1958 this->setTextEncoding(static_cast<TextEncoding>((tmp >> 0) & 0xFF)); |
1959 | 1959 |
1960 if (flatFlags & kHasTypeface_FlatFlag) { | 1960 if (flatFlags & kHasTypeface_FlatFlag) { |
1961 this->setTypeface(sk_ref_sp(buffer.readTypeface())); | 1961 this->setTypeface(buffer.readTypeface()); |
1962 } else { | 1962 } else { |
1963 this->setTypeface(nullptr); | 1963 this->setTypeface(nullptr); |
1964 } | 1964 } |
1965 | 1965 |
1966 if (flatFlags & kHasEffects_FlatFlag) { | 1966 if (flatFlags & kHasEffects_FlatFlag) { |
1967 this->setPathEffect(buffer.readPathEffect()); | 1967 this->setPathEffect(buffer.readPathEffect()); |
1968 this->setShader(buffer.readShader()); | 1968 this->setShader(buffer.readShader()); |
1969 this->setXfermode(buffer.readXfermode()); | 1969 this->setXfermode(buffer.readXfermode()); |
1970 this->setMaskFilter(buffer.readMaskFilter()); | 1970 this->setMaskFilter(buffer.readMaskFilter()); |
1971 this->setColorFilter(buffer.readColorFilter()); | 1971 this->setColorFilter(buffer.readColorFilter()); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 } | 2384 } |
2385 | 2385 |
2386 uint32_t SkPaint::getHash() const { | 2386 uint32_t SkPaint::getHash() const { |
2387 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2387 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, |
2388 // so fBitfields should be 10 pointers and 6 32-bit values from the start. | 2388 // so fBitfields should be 10 pointers and 6 32-bit values from the start. |
2389 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo
f(uint32_t), | 2389 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo
f(uint32_t), |
2390 "SkPaint_notPackedTightly"); | 2390 "SkPaint_notPackedTightly"); |
2391 return SkOpts::hash(reinterpret_cast<const uint32_t*>(this), | 2391 return SkOpts::hash(reinterpret_cast<const uint32_t*>(this), |
2392 offsetof(SkPaint, fBitfields) + sizeof(fBitfields)); | 2392 offsetof(SkPaint, fBitfields) + sizeof(fBitfields)); |
2393 } | 2393 } |
OLD | NEW |