| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 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 | 9 |
| 10 #include "SkAdvancedTypefaceMetrics.h" | 10 #include "SkAdvancedTypefaceMetrics.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 firstIndex = static_cast<int>(subsetGlyphIDs[0]); | 162 firstIndex = static_cast<int>(subsetGlyphIDs[0]); |
| 163 lastIndex = | 163 lastIndex = |
| 164 static_cast<int>(subsetGlyphIDs[subsetGlyphIDsLength - 1]) + 1; | 164 static_cast<int>(subsetGlyphIDs[subsetGlyphIDsLength - 1]) + 1; |
| 165 } | 165 } |
| 166 curRange = appendRange(&result, firstIndex); | 166 curRange = appendRange(&result, firstIndex); |
| 167 | 167 |
| 168 for (int gId = firstIndex; gId <= lastIndex; gId++) { | 168 for (int gId = firstIndex; gId <= lastIndex; gId++) { |
| 169 Data advance = kInvalidAdvance; | 169 Data advance = kInvalidAdvance; |
| 170 if (gId < lastIndex) { | 170 if (gId < lastIndex) { |
| 171 // Get glyph id only when subset is NULL, or the id is in subset. | 171 // Get glyph id only when subset is NULL, or the id is in subset. |
| 172 SkASSERT(!subsetGlyphIDs || (subsetIndex < subsetGlyphIDsLength && |
| 173 static_cast<uint32_t>(gId) <= subsetGlyphIDs[subsetIndex])); |
| 172 if (!subsetGlyphIDs || | 174 if (!subsetGlyphIDs || |
| 173 (subsetIndex < subsetGlyphIDsLength && | 175 (subsetIndex < subsetGlyphIDsLength && |
| 174 static_cast<uint32_t>(gId) == subsetGlyphIDs[subsetIndex])) { | 176 static_cast<uint32_t>(gId) == subsetGlyphIDs[subsetIndex])) { |
| 175 SkAssertResult(getAdvance(fontHandle, gId, &advance)); | 177 SkAssertResult(getAdvance(fontHandle, gId, &advance)); |
| 176 ++subsetIndex; | 178 ++subsetIndex; |
| 177 } else { | 179 } else { |
| 178 advance = kDontCareAdvance; | 180 advance = kDontCareAdvance; |
| 179 } | 181 } |
| 180 } | 182 } |
| 181 if (advance == lastAdvance) { | 183 if (advance == lastAdvance) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 308 |
| 307 // additional declaration needed for testing with a face of an unknown type | 309 // additional declaration needed for testing with a face of an unknown type |
| 308 template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData( | 310 template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData( |
| 309 void* fontData, | 311 void* fontData, |
| 310 int num_glyphs, | 312 int num_glyphs, |
| 311 const uint32_t* subsetGlyphIDs, | 313 const uint32_t* subsetGlyphIDs, |
| 312 uint32_t subsetGlyphIDsLength, | 314 uint32_t subsetGlyphIDsLength, |
| 313 bool (*getAdvance)(void* fontData, int gId, int16_t* data)); | 315 bool (*getAdvance)(void* fontData, int gId, int16_t* data)); |
| 314 | 316 |
| 315 } // namespace skia_advanced_typeface_metrics_utils | 317 } // namespace skia_advanced_typeface_metrics_utils |
| OLD | NEW |