OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
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 "SkDataTable.h" | 8 #include "SkDataTable.h" |
9 #include "SkFontDescriptor.h" | 9 #include "SkFontDescriptor.h" |
10 #include "SkFontHost_FreeType_common.h" | 10 #include "SkFontHost_FreeType_common.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 * Like all synthetic information, such information must be passed with the fon
t data. | 50 * Like all synthetic information, such information must be passed with the fon
t data. |
51 */ | 51 */ |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
55 // Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a glob
al mutex. | 55 // Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a glob
al mutex. |
56 // See http://skbug.com/1497 for background. | 56 // See http://skbug.com/1497 for background. |
57 SK_DECLARE_STATIC_MUTEX(gFCMutex); | 57 SK_DECLARE_STATIC_MUTEX(gFCMutex); |
58 | 58 |
59 #ifdef SK_DEBUG | 59 #ifdef SK_DEBUG |
60 void *CreateThreadFcLocked() { return SkNEW(bool); } | 60 void *CreateThreadFcLocked() { return SkNEW_ARGS(bool, (false)); } |
61 void DeleteThreadFcLocked(void* v) { SkDELETE(static_cast<bool*>(v)); } | 61 void DeleteThreadFcLocked(void* v) { SkDELETE(static_cast<bool*>(v)); } |
62 # define THREAD_FC_LOCKED \ | 62 # define THREAD_FC_LOCKED \ |
63 static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked
)) | 63 static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked
)) |
64 #endif | 64 #endif |
65 | 65 |
66 struct FCLocker { | 66 struct FCLocker { |
67 // Assume FcGetVersion() has always been thread safe. | 67 // Assume FcGetVersion() has always been thread safe. |
68 | 68 |
69 FCLocker() { | 69 FCLocker() { |
70 if (FcGetVersion() < 21091) { | 70 if (FcGetVersion() < 21091) { |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 return typeface.detach(); | 800 return typeface.detach(); |
801 } | 801 } |
802 | 802 |
803 return this->matchFamilyStyle(NULL, style); | 803 return this->matchFamilyStyle(NULL, style); |
804 } | 804 } |
805 }; | 805 }; |
806 | 806 |
807 SkFontMgr* SkFontMgr::Factory() { | 807 SkFontMgr* SkFontMgr::Factory() { |
808 return SkNEW(SkFontMgr_fontconfig); | 808 return SkNEW(SkFontMgr_fontconfig); |
809 } | 809 } |
OLD | NEW |