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 #include <vector> | 9 #include <vector> |
10 #ifdef SK_BUILD_FOR_MAC | 10 #ifdef SK_BUILD_FOR_MAC |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 CTFontDescriptorCreateWithAttributes(cfAttributes)); | 519 CTFontDescriptorCreateWithAttributes(cfAttributes)); |
520 | 520 |
521 if (ctFontDesc != NULL) { | 521 if (ctFontDesc != NULL) { |
522 ctFont = CTFontCreateWithFontDescriptor(ctFontDesc, 0, NULL); | 522 ctFont = CTFontCreateWithFontDescriptor(ctFontDesc, 0, NULL); |
523 } | 523 } |
524 } | 524 } |
525 | 525 |
526 return ctFont ? NewFromFontRef(ctFont, familyName, false) : NULL; | 526 return ctFont ? NewFromFontRef(ctFont, familyName, false) : NULL; |
527 } | 527 } |
528 | 528 |
| 529 SK_DECLARE_STATIC_MUTEX(gGetDefaultFaceMutex); |
529 static SkTypeface* GetDefaultFace() { | 530 static SkTypeface* GetDefaultFace() { |
530 SK_DECLARE_STATIC_MUTEX(gMutex); | 531 SkAutoMutexAcquire ma(gGetDefaultFaceMutex); |
531 SkAutoMutexAcquire ma(gMutex); | |
532 | 532 |
533 static SkTypeface* gDefaultFace; | 533 static SkTypeface* gDefaultFace; |
534 | 534 |
535 if (NULL == gDefaultFace) { | 535 if (NULL == gDefaultFace) { |
536 gDefaultFace = NewFromName(FONT_DEFAULT_NAME, SkTypeface::kNormal); | 536 gDefaultFace = NewFromName(FONT_DEFAULT_NAME, SkTypeface::kNormal); |
537 SkTypefaceCache::Add(gDefaultFace, SkTypeface::kNormal); | 537 SkTypefaceCache::Add(gDefaultFace, SkTypeface::kNormal); |
538 } | 538 } |
539 return gDefaultFace; | 539 return gDefaultFace; |
540 } | 540 } |
541 | 541 |
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2304 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits); | 2304 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits); |
2305 } | 2305 } |
2306 }; | 2306 }; |
2307 | 2307 |
2308 /////////////////////////////////////////////////////////////////////////////// | 2308 /////////////////////////////////////////////////////////////////////////////// |
2309 | 2309 |
2310 SkFontMgr* SkFontMgr::Factory() { | 2310 SkFontMgr* SkFontMgr::Factory() { |
2311 return SkNEW(SkFontMgr_Mac); | 2311 return SkNEW(SkFontMgr_Mac); |
2312 } | 2312 } |
2313 #endif | 2313 #endif |
OLD | NEW |