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 2289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2300 } | 2300 } |
2301 | 2301 |
2302 if (this->getImageFilter()) { | 2302 if (this->getImageFilter()) { |
2303 this->getImageFilter()->computeFastBounds(*storage, storage); | 2303 this->getImageFilter()->computeFastBounds(*storage, storage); |
2304 } | 2304 } |
2305 | 2305 |
2306 return *storage; | 2306 return *storage; |
2307 } | 2307 } |
2308 | 2308 |
2309 #ifndef SK_IGNORE_TO_STRING | 2309 #ifndef SK_IGNORE_TO_STRING |
| 2310 |
| 2311 static SkFontDescriptor typeface_getDescriptor(const SkTypeface* face) { |
| 2312 SkDynamicMemoryWStream ostream; |
| 2313 face->serialize(&ostream); |
| 2314 SkAutoTUnref<SkStreamAsset> istream(ostream.detachAsStream()); |
| 2315 return SkFontDescriptor(istream); |
| 2316 } |
| 2317 |
2310 void SkPaint::toString(SkString* str) const { | 2318 void SkPaint::toString(SkString* str) const { |
2311 str->append("<dl><dt>SkPaint:</dt><dd><dl>"); | 2319 str->append("<dl><dt>SkPaint:</dt><dd><dl>"); |
2312 | 2320 |
2313 SkTypeface* typeface = this->getTypeface(); | 2321 SkTypeface* typeface = this->getTypeface(); |
2314 if (typeface) { | 2322 if (typeface) { |
2315 SkDynamicMemoryWStream ostream; | 2323 SkFontDescriptor descriptor(typeface_getDescriptor(typeface)); |
2316 typeface->serialize(&ostream); | |
2317 SkAutoTUnref<SkData> data(ostream.copyToData()); | |
2318 | |
2319 SkMemoryStream stream(data); | |
2320 SkFontDescriptor descriptor(&stream); | |
2321 | 2324 |
2322 str->append("<dt>Font Family Name:</dt><dd>"); | 2325 str->append("<dt>Font Family Name:</dt><dd>"); |
2323 str->append(descriptor.getFamilyName()); | 2326 str->append(descriptor.getFamilyName()); |
2324 str->append("</dd><dt>Font Full Name:</dt><dd>"); | 2327 str->append("</dd><dt>Font Full Name:</dt><dd>"); |
2325 str->append(descriptor.getFullName()); | 2328 str->append(descriptor.getFullName()); |
2326 str->append("</dd><dt>Font PS Name:</dt><dd>"); | 2329 str->append("</dd><dt>Font PS Name:</dt><dd>"); |
2327 str->append(descriptor.getPostscriptName()); | 2330 str->append(descriptor.getPostscriptName()); |
2328 str->append("</dd><dt>Font File Name:</dt><dd>"); | 2331 str->append("</dd><dt>Font File Name:</dt><dd>"); |
2329 str->append(descriptor.getFontFileName()); | 2332 str->append(descriptor.getFontFileName()); |
2330 str->append("</dd>"); | 2333 str->append("</dd>"); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2671 F_UNREF(Looper, readDrawLooper); | 2674 F_UNREF(Looper, readDrawLooper); |
2672 F_UNREF(ImageFilter, readImageFilter); | 2675 F_UNREF(ImageFilter, readImageFilter); |
2673 F(Typeface, readTypeface); | 2676 F(Typeface, readTypeface); |
2674 #undef F | 2677 #undef F |
2675 #undef F_UNREF | 2678 #undef F_UNREF |
2676 if (dirty & kAnnotation_DirtyBit) { | 2679 if (dirty & kAnnotation_DirtyBit) { |
2677 paint->setAnnotation(SkAnnotation::Create(buffer))->unref(); | 2680 paint->setAnnotation(SkAnnotation::Create(buffer))->unref(); |
2678 } | 2681 } |
2679 SkASSERT(dirty == paint->fDirtyBits); | 2682 SkASSERT(dirty == paint->fDirtyBits); |
2680 } | 2683 } |
OLD | NEW |