| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifdef SK_BUILD_FOR_MAC | 9 #ifdef SK_BUILD_FOR_MAC |
| 10 #import <ApplicationServices/ApplicationServices.h> | 10 #import <ApplicationServices/ApplicationServices.h> |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 | 562 |
| 563 extern CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face); | 563 extern CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face); |
| 564 CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face) { | 564 CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face) { |
| 565 const SkTypeface_Mac* macface = (const SkTypeface_Mac*)face; | 565 const SkTypeface_Mac* macface = (const SkTypeface_Mac*)face; |
| 566 return macface ? macface->fFontRef.get() : NULL; | 566 return macface ? macface->fFontRef.get() : NULL; |
| 567 } | 567 } |
| 568 | 568 |
| 569 /* This function is visible on the outside. It first searches the cache, and if | 569 /* This function is visible on the outside. It first searches the cache, and if |
| 570 * not found, returns a new entry (after adding it to the cache). | 570 * not found, returns a new entry (after adding it to the cache). |
| 571 */ | 571 */ |
| 572 SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef fontRef) { | 572 SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef fontRef, bool isLocalStream) { |
| 573 SkFontID fontID = CTFontRef_to_SkFontID(fontRef); | 573 SkFontID fontID = CTFontRef_to_SkFontID(fontRef); |
| 574 SkTypeface* face = SkTypefaceCache::FindByID(fontID); | 574 SkTypeface* face = SkTypefaceCache::FindByID(fontID); |
| 575 if (face) { | 575 if (face) { |
| 576 face->ref(); | 576 face->ref(); |
| 577 } else { | 577 } else { |
| 578 face = NewFromFontRef(fontRef, NULL, false); | 578 face = NewFromFontRef(fontRef, NULL, isLocalStream); |
| 579 SkTypefaceCache::Add(face, face->fontStyle()); | 579 SkTypefaceCache::Add(face, face->fontStyle()); |
| 580 // NewFromFontRef doesn't retain the parameter, but the typeface it | 580 // NewFromFontRef doesn't retain the parameter, but the typeface it |
| 581 // creates does release it in its destructor, so we balance that with | 581 // creates does release it in its destructor, so we balance that with |
| 582 // a retain call here. | 582 // a retain call here. |
| 583 CFRetain(fontRef); | 583 CFRetain(fontRef); |
| 584 } | 584 } |
| 585 SkASSERT(face->getRefCnt() > 1); | 585 SkASSERT(face->getRefCnt() > 1); |
| 586 return face; | 586 return face; |
| 587 } | 587 } |
| 588 | 588 |
| (...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2242 } | 2242 } |
| 2243 return face; | 2243 return face; |
| 2244 } | 2244 } |
| 2245 }; | 2245 }; |
| 2246 | 2246 |
| 2247 /////////////////////////////////////////////////////////////////////////////// | 2247 /////////////////////////////////////////////////////////////////////////////// |
| 2248 | 2248 |
| 2249 SkFontMgr* SkFontMgr::Factory() { | 2249 SkFontMgr* SkFontMgr::Factory() { |
| 2250 return SkNEW(SkFontMgr_Mac); | 2250 return SkNEW(SkFontMgr_Mac); |
| 2251 } | 2251 } |
| OLD | NEW |