Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: src/ports/SkFontHost_mac.cpp

Issue 692553002: Add a flag indicating locally-created fonts to SkCreateTypefaceFromCTFont (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: just add isLocal flag to SkCreateTypefaceFromCTFont Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/ports/SkTypeface_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « include/ports/SkTypeface_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698