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 "SkAnnotation.h" | 9 #include "SkAnnotation.h" |
10 #include "SkAutoKern.h" | 10 #include "SkAutoKern.h" |
11 #include "SkChecksum.h" | 11 #include "SkChecksum.h" |
12 #include "SkColorFilter.h" | 12 #include "SkColorFilter.h" |
13 #include "SkData.h" | 13 #include "SkData.h" |
14 #include "SkDeviceProperties.h" | 14 #include "SkDeviceProperties.h" |
15 #include "SkDraw.h" | 15 #include "SkDraw.h" |
16 #include "SkFontDescriptor.h" | 16 #include "SkFontDescriptor.h" |
17 #include "SkFontHost.h" | |
18 #include "SkGlyphCache.h" | 17 #include "SkGlyphCache.h" |
19 #include "SkImageFilter.h" | 18 #include "SkImageFilter.h" |
20 #include "SkMaskFilter.h" | 19 #include "SkMaskFilter.h" |
21 #include "SkMaskGamma.h" | 20 #include "SkMaskGamma.h" |
22 #include "SkReadBuffer.h" | 21 #include "SkReadBuffer.h" |
23 #include "SkWriteBuffer.h" | 22 #include "SkWriteBuffer.h" |
24 #include "SkPaintDefaults.h" | 23 #include "SkPaintDefaults.h" |
25 #include "SkPathEffect.h" | 24 #include "SkPathEffect.h" |
26 #include "SkRasterizer.h" | 25 #include "SkRasterizer.h" |
27 #include "SkScalar.h" | 26 #include "SkScalar.h" |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 SkRect bounds; | 1249 SkRect bounds; |
1251 m.mapRect(&bounds, typeface->getBounds()); | 1250 m.mapRect(&bounds, typeface->getBounds()); |
1252 return bounds; | 1251 return bounds; |
1253 } | 1252 } |
1254 | 1253 |
1255 static void add_flattenable(SkDescriptor* desc, uint32_t tag, | 1254 static void add_flattenable(SkDescriptor* desc, uint32_t tag, |
1256 SkWriteBuffer* buffer) { | 1255 SkWriteBuffer* buffer) { |
1257 buffer->writeToMemory(desc->addEntry(tag, buffer->bytesWritten(), NULL)); | 1256 buffer->writeToMemory(desc->addEntry(tag, buffer->bytesWritten(), NULL)); |
1258 } | 1257 } |
1259 | 1258 |
1260 // SkFontHost can override this choice in FilterRec() | |
1261 static SkMask::Format computeMaskFormat(const SkPaint& paint) { | 1259 static SkMask::Format computeMaskFormat(const SkPaint& paint) { |
1262 uint32_t flags = paint.getFlags(); | 1260 uint32_t flags = paint.getFlags(); |
1263 | 1261 |
1264 // Antialiasing being disabled trumps all other settings. | 1262 // Antialiasing being disabled trumps all other settings. |
1265 if (!(flags & SkPaint::kAntiAlias_Flag)) { | 1263 if (!(flags & SkPaint::kAntiAlias_Flag)) { |
1266 return SkMask::kBW_Format; | 1264 return SkMask::kBW_Format; |
1267 } | 1265 } |
1268 | 1266 |
1269 if (flags & SkPaint::kLCDRenderText_Flag) { | 1267 if (flags & SkPaint::kLCDRenderText_Flag) { |
1270 return SkMask::kLCD16_Format; | 1268 return SkMask::kLCD16_Format; |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 } | 2382 } |
2385 | 2383 |
2386 uint32_t SkPaint::getHash() const { | 2384 uint32_t SkPaint::getHash() const { |
2387 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2385 // 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. | 2386 // so fBitfields should be 10 pointers and 6 32-bit values from the start. |
2389 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 *
sizeof(uint32_t), | 2387 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 *
sizeof(uint32_t), |
2390 SkPaint_notPackedTightly); | 2388 SkPaint_notPackedTightly); |
2391 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2389 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
2392 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2390 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
2393 } | 2391 } |
OLD | NEW |