Index: src/core/SkPaint.cpp |
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp |
index 5d7c2cc3ebc4420b3ef5e027d291e2159d984a0a..1c2f8e83a6eba738ec542ac1f96808392556db8e 100644 |
--- a/src/core/SkPaint.cpp |
+++ b/src/core/SkPaint.cpp |
@@ -2307,17 +2307,20 @@ const SkRect& SkPaint::doComputeFastBounds(const SkRect& origSrc, |
} |
#ifndef SK_IGNORE_TO_STRING |
+ |
+static SkFontDescriptor typeface_getDescriptor(const SkTypeface* face) { |
+ SkDynamicMemoryWStream ostream; |
+ face->serialize(&ostream); |
+ SkAutoTUnref<SkStreamAsset> istream(ostream.detachAsStream()); |
+ return SkFontDescriptor(istream); |
+} |
+ |
void SkPaint::toString(SkString* str) const { |
str->append("<dl><dt>SkPaint:</dt><dd><dl>"); |
SkTypeface* typeface = this->getTypeface(); |
if (typeface) { |
- SkDynamicMemoryWStream ostream; |
- typeface->serialize(&ostream); |
- SkAutoTUnref<SkData> data(ostream.copyToData()); |
- |
- SkMemoryStream stream(data); |
- SkFontDescriptor descriptor(&stream); |
+ SkFontDescriptor descriptor(typeface_getDescriptor(typeface)); |
str->append("<dt>Font Family Name:</dt><dd>"); |
str->append(descriptor.getFamilyName()); |