Chromium Code Reviews| 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 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 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); | |
|
bungeman-skia
2014/09/18 14:50:09
This required a copy constructor, and that seems a
| |
| 2316 } | |
| 2317 | |
| 2318 void SkPaint::toString(SkString* str) const { | 2311 void SkPaint::toString(SkString* str) const { |
| 2319 str->append("<dl><dt>SkPaint:</dt><dd><dl>"); | 2312 str->append("<dl><dt>SkPaint:</dt><dd><dl>"); |
| 2320 | 2313 |
| 2321 SkTypeface* typeface = this->getTypeface(); | 2314 SkTypeface* typeface = this->getTypeface(); |
| 2322 if (typeface) { | 2315 if (typeface) { |
| 2323 SkFontDescriptor descriptor(typeface_getDescriptor(typeface)); | 2316 SkDynamicMemoryWStream ostream; |
| 2317 typeface->serialize(&ostream); | |
| 2318 SkAutoTUnref<SkStreamAsset> istream(ostream.detachAsStream()); | |
| 2319 SkFontDescriptor descriptor(istream); | |
| 2324 | 2320 |
| 2325 str->append("<dt>Font Family Name:</dt><dd>"); | 2321 str->append("<dt>Font Family Name:</dt><dd>"); |
| 2326 str->append(descriptor.getFamilyName()); | 2322 str->append(descriptor.getFamilyName()); |
| 2327 str->append("</dd><dt>Font Full Name:</dt><dd>"); | 2323 str->append("</dd><dt>Font Full Name:</dt><dd>"); |
| 2328 str->append(descriptor.getFullName()); | 2324 str->append(descriptor.getFullName()); |
| 2329 str->append("</dd><dt>Font PS Name:</dt><dd>"); | 2325 str->append("</dd><dt>Font PS Name:</dt><dd>"); |
| 2330 str->append(descriptor.getPostscriptName()); | 2326 str->append(descriptor.getPostscriptName()); |
| 2331 str->append("</dd><dt>Font File Name:</dt><dd>"); | 2327 str->append("</dd><dt>Font File Name:</dt><dd>"); |
| 2332 str->append(descriptor.getFontFileName()); | 2328 str->append(descriptor.getFontFileName()); |
| 2333 str->append("</dd>"); | 2329 str->append("</dd>"); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2674 F_UNREF(Looper, readDrawLooper); | 2670 F_UNREF(Looper, readDrawLooper); |
| 2675 F_UNREF(ImageFilter, readImageFilter); | 2671 F_UNREF(ImageFilter, readImageFilter); |
| 2676 F(Typeface, readTypeface); | 2672 F(Typeface, readTypeface); |
| 2677 #undef F | 2673 #undef F |
| 2678 #undef F_UNREF | 2674 #undef F_UNREF |
| 2679 if (dirty & kAnnotation_DirtyBit) { | 2675 if (dirty & kAnnotation_DirtyBit) { |
| 2680 paint->setAnnotation(SkAnnotation::Create(buffer))->unref(); | 2676 paint->setAnnotation(SkAnnotation::Create(buffer))->unref(); |
| 2681 } | 2677 } |
| 2682 SkASSERT(dirty == paint->fDirtyBits); | 2678 SkASSERT(dirty == paint->fDirtyBits); |
| 2683 } | 2679 } |
| OLD | NEW |