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" |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 while (iter.next(&iterPath, NULL)) { | 1230 while (iter.next(&iterPath, NULL)) { |
1231 matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY); | 1231 matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY); |
1232 if (iterPath) { | 1232 if (iterPath) { |
1233 path->addPath(*iterPath, matrix); | 1233 path->addPath(*iterPath, matrix); |
1234 } | 1234 } |
1235 prevPos = pos[i]; | 1235 prevPos = pos[i]; |
1236 i++; | 1236 i++; |
1237 } | 1237 } |
1238 } | 1238 } |
1239 | 1239 |
| 1240 SkRect SkPaint::getFontBounds() const { |
| 1241 SkMatrix m; |
| 1242 m.setScale(fTextSize * fTextScaleX, fTextSize); |
| 1243 m.postSkew(fTextSkewX, 0); |
| 1244 |
| 1245 SkTypeface* typeface = this->getTypeface(); |
| 1246 if (NULL == typeface) { |
| 1247 typeface = SkTypeface::GetDefaultTypeface(); |
| 1248 } |
| 1249 |
| 1250 SkRect bounds; |
| 1251 m.mapRect(&bounds, typeface->getBounds()); |
| 1252 return bounds; |
| 1253 } |
| 1254 |
1240 static void add_flattenable(SkDescriptor* desc, uint32_t tag, | 1255 static void add_flattenable(SkDescriptor* desc, uint32_t tag, |
1241 SkWriteBuffer* buffer) { | 1256 SkWriteBuffer* buffer) { |
1242 buffer->writeToMemory(desc->addEntry(tag, buffer->bytesWritten(), NULL)); | 1257 buffer->writeToMemory(desc->addEntry(tag, buffer->bytesWritten(), NULL)); |
1243 } | 1258 } |
1244 | 1259 |
1245 // SkFontHost can override this choice in FilterRec() | 1260 // SkFontHost can override this choice in FilterRec() |
1246 static SkMask::Format computeMaskFormat(const SkPaint& paint) { | 1261 static SkMask::Format computeMaskFormat(const SkPaint& paint) { |
1247 uint32_t flags = paint.getFlags(); | 1262 uint32_t flags = paint.getFlags(); |
1248 | 1263 |
1249 // Antialiasing being disabled trumps all other settings. | 1264 // Antialiasing being disabled trumps all other settings. |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2369 } | 2384 } |
2370 | 2385 |
2371 uint32_t SkPaint::getHash() const { | 2386 uint32_t SkPaint::getHash() const { |
2372 // 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, |
2373 // 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. |
2374 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 *
sizeof(uint32_t), | 2389 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 *
sizeof(uint32_t), |
2375 SkPaint_notPackedTightly); | 2390 SkPaint_notPackedTightly); |
2376 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2391 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
2377 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2392 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
2378 } | 2393 } |
OLD | NEW |