@@ -551,8 +551,7 @@ void TextLayoutCacheValue::computeRunValuesWithHarfbuzz(SkPaint* paint, const UC
551551 // Get LogClusters
552552 if (outLogClusters) {
553553 size_t countLogClusters = outLogClusters->size ();
554- size_t countGlyphs = shaperItem.num_glyphs ;
555- for (size_t i = 0 ; i < countGlyphs; i++) {
554+ for (size_t i = 0 ; i < count; i++) {
556555 // As there may be successive runs, we need to shift the log clusters
557556 unsigned short logCluster = shaperItem.log_clusters [i] + countLogClusters;
558557#if DEBUG_GLYPHS
@@ -620,25 +619,15 @@ void TextLayoutCacheValue::getGlyphsIndexAndCount(size_t start, size_t count, si
620619 *outGlyphsCount = 0 ;
621620 return ;
622621 }
623- size_t endIndex = 0 ;
624- for (size_t i = 0 ; i < mGlyphs .size (); i++) {
625- if (mLogClusters [i] <= start) {
626- *outStartIndex = i;
627- endIndex = i;
628- continue ;
629- }
630- if (mLogClusters [i] <= start + count) {
631- endIndex = i;
632- }
633- }
634- *outGlyphsCount = endIndex - *outStartIndex + 1 ;
622+ *outStartIndex = mLogClusters [start];
623+ *outGlyphsCount = mLogClusters [start + count - 1 ] - mLogClusters [start] + 1 ;
635624#if DEBUG_GLYPHS
636625 LOGD (" getGlyphsIndexes - start=%d count=%d - startIndex=%d count=%d" , start, count,
637626 *outStartIndex, *outGlyphsCount);
638627 for (size_t i = 0 ; i < mGlyphs .size (); i++) {
639628 LOGD (" getGlyphs - all - glyph[%d] = %d" , i, mGlyphs [i]);
640629 }
641- for (size_t i = 0 ; i < mGlyphs .size (); i++) {
630+ for (size_t i = 0 ; i < mAdvances .size (); i++) {
642631 LOGD (" getGlyphs - all - logcl[%d] = %d" , i, mLogClusters [i]);
643632 }
644633#endif
0 commit comments