aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPaint.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkPaint.cpp')
-rw-r--r--src/core/SkPaint.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 5d7c2cc3eb..1c2f8e83a6 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());