OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkBitSet.h" | 8 #include "SkBitSet.h" |
9 #include "SkPDFMakeCIDGlyphWidthsArray.h" | 9 #include "SkPDFMakeCIDGlyphWidthsArray.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 bool prevRange = false; | 164 bool prevRange = false; |
165 | 165 |
166 int16_t lastAdvance = kInvalidAdvance; | 166 int16_t lastAdvance = kInvalidAdvance; |
167 int repeatedAdvances = 0; | 167 int repeatedAdvances = 0; |
168 int wildCardsInRun = 0; | 168 int wildCardsInRun = 0; |
169 int trailingWildCards = 0; | 169 int trailingWildCards = 0; |
170 | 170 |
171 // Limit the loop count to glyph id ranges provided. | 171 // Limit the loop count to glyph id ranges provided. |
172 int lastIndex = num_glyphs; | 172 int lastIndex = num_glyphs; |
173 if (subset) { | 173 if (subset) { |
174 while (!subset->isBitSet(lastIndex - 1) && lastIndex > 0) { | 174 while (!subset->has(lastIndex - 1) && lastIndex > 0) { |
175 --lastIndex; | 175 --lastIndex; |
176 } | 176 } |
177 } | 177 } |
178 AdvanceMetric curRange(0); | 178 AdvanceMetric curRange(0); |
179 | 179 |
180 for (int gId = 0; gId <= lastIndex; gId++) { | 180 for (int gId = 0; gId <= lastIndex; gId++) { |
181 int16_t advance = kInvalidAdvance; | 181 int16_t advance = kInvalidAdvance; |
182 if (gId < lastIndex) { | 182 if (gId < lastIndex) { |
183 if (!subset || 0 == gId || subset->isBitSet(gId)) { | 183 if (!subset || 0 == gId || subset->has(gId)) { |
184 advance = (int16_t)cache->getGlyphIDAdvance(gId).fAdvanceX; | 184 advance = (int16_t)cache->getGlyphIDAdvance(gId).fAdvanceX; |
185 } else { | 185 } else { |
186 advance = kDontCareAdvance; | 186 advance = kDontCareAdvance; |
187 } | 187 } |
188 } | 188 } |
189 if (advance == lastAdvance) { | 189 if (advance == lastAdvance) { |
190 repeatedAdvances++; | 190 repeatedAdvances++; |
191 trailingWildCards = 0; | 191 trailingWildCards = 0; |
192 } else if (advance == kDontCareAdvance) { | 192 } else if (advance == kDontCareAdvance) { |
193 wildCardsInRun++; | 193 wildCardsInRun++; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 if (curRange.fStartId == lastIndex) { | 253 if (curRange.fStartId == lastIndex) { |
254 if (!prevRange) { | 254 if (!prevRange) { |
255 return nullptr; // https://crbug.com/567031 | 255 return nullptr; // https://crbug.com/567031 |
256 } | 256 } |
257 } else { | 257 } else { |
258 finish_range(&curRange, lastIndex - 1, AdvanceMetric::kRange); | 258 finish_range(&curRange, lastIndex - 1, AdvanceMetric::kRange); |
259 compose_advance_data(curRange, emSize, defaultAdvance, result.get()); | 259 compose_advance_data(curRange, emSize, defaultAdvance, result.get()); |
260 } | 260 } |
261 return result; | 261 return result; |
262 } | 262 } |
OLD | NEW |