| OLD | NEW |
| 1 /* libs/graphics/ports/SkFontHost_fontconfig_direct.cpp | 1 /* libs/graphics/ports/SkFontHost_fontconfig_direct.cpp |
| 2 ** | 2 ** |
| 3 ** Copyright 2009, Google Inc. | 3 ** Copyright 2009, Google Inc. |
| 4 ** | 4 ** |
| 5 ** Licensed under the Apache License, Version 2.0 (the "License"); | 5 ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 ** you may not use this file except in compliance with the License. | 6 ** you may not use this file except in compliance with the License. |
| 7 ** You may obtain a copy of the License at | 7 ** You may obtain a copy of the License at |
| 8 ** | 8 ** |
| 9 ** http://www.apache.org/licenses/LICENSE-2.0 | 9 ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 ** | 10 ** |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 i = filename_to_fileid_.find(filename); | 147 i = filename_to_fileid_.find(filename); |
| 148 if (i == filename_to_fileid_.end()) { | 148 if (i == filename_to_fileid_.end()) { |
| 149 out_fileid = next_file_id_++; | 149 out_fileid = next_file_id_++; |
| 150 filename_to_fileid_[filename] = out_fileid; | 150 filename_to_fileid_[filename] = out_fileid; |
| 151 fileid_to_filename_[out_fileid] = filename; | 151 fileid_to_filename_[out_fileid] = filename; |
| 152 } else { | 152 } else { |
| 153 out_fileid = i->second; | 153 out_fileid = i->second; |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 if (*result_fileid) | 157 if (result_fileid) |
| 158 *result_fileid = out_fileid; | 158 *result_fileid = out_fileid; |
| 159 | 159 |
| 160 FcChar8* c_family; | 160 FcChar8* c_family; |
| 161 if (FcPatternGetString(match, FC_FAMILY, 0, &c_family)) { | 161 if (FcPatternGetString(match, FC_FAMILY, 0, &c_family)) { |
| 162 FcPatternDestroy(match); | 162 FcPatternDestroy(match); |
| 163 return NULL; | 163 return NULL; |
| 164 } | 164 } |
| 165 | 165 |
| 166 if (result_family) | 166 if (result_family) |
| 167 *result_family = (char *) c_family; | 167 *result_family = (char *) c_family; |
| 168 | 168 |
| 169 FcPatternDestroy(match); | 169 FcPatternDestroy(match); |
| 170 | 170 |
| 171 return true; | 171 return true; |
| 172 } | 172 } |
| 173 | 173 |
| 174 int FontConfigDirect::Open(unsigned fileid) { | 174 int FontConfigDirect::Open(unsigned fileid) { |
| 175 SkAutoMutexAcquire ac(mutex_); | 175 SkAutoMutexAcquire ac(mutex_); |
| 176 const std::map<unsigned, std::string>::const_iterator | 176 const std::map<unsigned, std::string>::const_iterator |
| 177 i = fileid_to_filename_.find(fileid); | 177 i = fileid_to_filename_.find(fileid); |
| 178 if (i == fileid_to_filename_.end()) | 178 if (i == fileid_to_filename_.end()) |
| 179 return -1; | 179 return -1; |
| 180 | 180 |
| 181 return open(i->second.c_str(), O_RDONLY); | 181 return open(i->second.c_str(), O_RDONLY); |
| 182 } | 182 } |
| OLD | NEW |