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 "SkTypes.h" // Keep this before any #ifdef ... | 8 #include "SkTypes.h" // Keep this before any #ifdef ... |
9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 9 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "SkUtils.h" | 47 #include "SkUtils.h" |
48 #include "SkUtils.h" | 48 #include "SkUtils.h" |
49 | 49 |
50 #include <dlfcn.h> | 50 #include <dlfcn.h> |
51 | 51 |
52 // Experimental code to use a global lock whenever we access CG, to see if this
reduces | 52 // Experimental code to use a global lock whenever we access CG, to see if this
reduces |
53 // crashes in Chrome | 53 // crashes in Chrome |
54 #define USE_GLOBAL_MUTEX_FOR_CG_ACCESS | 54 #define USE_GLOBAL_MUTEX_FOR_CG_ACCESS |
55 | 55 |
56 #ifdef USE_GLOBAL_MUTEX_FOR_CG_ACCESS | 56 #ifdef USE_GLOBAL_MUTEX_FOR_CG_ACCESS |
57 SK_DECLARE_STATIC_MUTEX(gCGMutex); | 57 static SkMutex gCGMutex; |
58 #define AUTO_CG_LOCK() SkAutoMutexAcquire amc(gCGMutex) | 58 #define AUTO_CG_LOCK() SkAutoMutexAcquire amc(gCGMutex) |
59 #else | 59 #else |
60 #define AUTO_CG_LOCK() | 60 #define AUTO_CG_LOCK() |
61 #endif | 61 #endif |
62 | 62 |
63 // Set to make glyph bounding boxes visible. | 63 // Set to make glyph bounding boxes visible. |
64 #define SK_SHOW_TEXT_BLIT_COVERAGE 0 | 64 #define SK_SHOW_TEXT_BLIT_COVERAGE 0 |
65 | 65 |
66 class SkScalerContext_Mac; | 66 class SkScalerContext_Mac; |
67 | 67 |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 543 |
544 SkTypeface* face = SkTypefaceCache::FindByProcAndRef(find_by_CTFontRef, (voi
d*)ctFont.get()); | 544 SkTypeface* face = SkTypefaceCache::FindByProcAndRef(find_by_CTFontRef, (voi
d*)ctFont.get()); |
545 if (face) { | 545 if (face) { |
546 return face; | 546 return face; |
547 } | 547 } |
548 face = NewFromFontRef(ctFont.release(), nullptr, false); | 548 face = NewFromFontRef(ctFont.release(), nullptr, false); |
549 SkTypefaceCache::Add(face); | 549 SkTypefaceCache::Add(face); |
550 return face; | 550 return face; |
551 } | 551 } |
552 | 552 |
553 SK_DECLARE_STATIC_MUTEX(gGetDefaultFaceMutex); | 553 static SkMutex gGetDefaultFaceMutex; |
554 static SkTypeface* GetDefaultFace() { | 554 static SkTypeface* GetDefaultFace() { |
555 SkAutoMutexAcquire ma(gGetDefaultFaceMutex); | 555 SkAutoMutexAcquire ma(gGetDefaultFaceMutex); |
556 | 556 |
557 static SkTypeface* gDefaultFace; | 557 static SkTypeface* gDefaultFace; |
558 | 558 |
559 if (nullptr == gDefaultFace) { | 559 if (nullptr == gDefaultFace) { |
560 gDefaultFace = NewFromName(FONT_DEFAULT_NAME, SkFontStyle()); | 560 gDefaultFace = NewFromName(FONT_DEFAULT_NAME, SkFontStyle()); |
561 } | 561 } |
562 return gDefaultFace; | 562 return gDefaultFace; |
563 } | 563 } |
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 | 2575 |
2576 return SkSafeRef(GetDefaultFace()); | 2576 return SkSafeRef(GetDefaultFace()); |
2577 } | 2577 } |
2578 }; | 2578 }; |
2579 | 2579 |
2580 /////////////////////////////////////////////////////////////////////////////// | 2580 /////////////////////////////////////////////////////////////////////////////// |
2581 | 2581 |
2582 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } | 2582 SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; } |
2583 | 2583 |
2584 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 2584 #endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
OLD | NEW |