OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 Google Inc. | 2 * Copyright 2009 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 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ | 8 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ |
9 | 9 |
10 #include "SkBuffer.h" | 10 #include "SkBuffer.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 SkTArray<FontIdentity>*) override; | 126 SkTArray<FontIdentity>*) override; |
127 | 127 |
128 private: | 128 private: |
129 SkMutex mutex_; | 129 SkMutex mutex_; |
130 }; | 130 }; |
131 | 131 |
132 SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBase
Mutex* mutex) { | 132 SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBase
Mutex* mutex) { |
133 SkAutoMutexAcquire ac(mutex); | 133 SkAutoMutexAcquire ac(mutex); |
134 static SkFontConfigInterfaceDirect* singleton = NULL; | 134 static SkFontConfigInterfaceDirect* singleton = NULL; |
135 if (singleton == NULL) { | 135 if (singleton == NULL) { |
136 singleton = SkNEW(SkFontConfigInterfaceDirect); | 136 singleton = new SkFontConfigInterfaceDirect; |
137 } | 137 } |
138 return singleton; | 138 return singleton; |
139 } | 139 } |
140 | 140 |
141 /////////////////////////////////////////////////////////////////////////////// | 141 /////////////////////////////////////////////////////////////////////////////// |
142 | 142 |
143 // Returns the string from the pattern, or NULL | 143 // Returns the string from the pattern, or NULL |
144 static const char* get_name(FcPattern* pattern, const char field[], | 144 static const char* get_name(FcPattern* pattern, const char field[], |
145 int index = 0) { | 145 int index = 0) { |
146 const char* name; | 146 const char* name; |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 FcPatternDestroy(pattern); | 726 FcPatternDestroy(pattern); |
727 | 727 |
728 SkTDArray<FcPattern*> trimmedMatches; | 728 SkTDArray<FcPattern*> trimmedMatches; |
729 for (int i = 0; i < count; ++i) { | 729 for (int i = 0; i < count; ++i) { |
730 const char* justName = find_just_name(get_name(match[i], FC_FILE)); | 730 const char* justName = find_just_name(get_name(match[i], FC_FILE)); |
731 if (!is_lower(*justName)) { | 731 if (!is_lower(*justName)) { |
732 *trimmedMatches.append() = match[i]; | 732 *trimmedMatches.append() = match[i]; |
733 } | 733 } |
734 } | 734 } |
735 | 735 |
736 SkFontStyleSet_FC* sset = SkNEW_ARGS(SkFontStyleSet_FC, | 736 SkFontStyleSet_FC* sset = new SkFontStyleSet_FC
(trimmedMatches.begin(),
trimmedMatches.count()); |
737 (trimmedMatches.begin(), | |
738 trimmedMatches.count())); | |
739 #endif | 737 #endif |
740 return false; | 738 return false; |
741 } | 739 } |
OLD | NEW |