Fix cluster reporting from shaper.
Bug: skia:8420
Change-Id: I7eea8c6b3af2153a1ac1189782fc6cbaaf9ee5c6
Reviewed-on: https://skia-review.googlesource.com/c/190821
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/modules/skshaper/src/SkShaper_primitive.cpp b/modules/skshaper/src/SkShaper_primitive.cpp
index 8980932..4b371c0 100644
--- a/modules/skshaper/src/SkShaper_primitive.cpp
+++ b/modules/skshaper/src/SkShaper_primitive.cpp
@@ -58,15 +58,12 @@
metrics.fDescent,
metrics.fLeading,
};
- const auto buffer = handler->newRunBuffer(info, font, glyphCount, textBytes);
+ const auto buffer = handler->newRunBuffer(info, font, glyphCount,
+ SkSpan<const char>(utf8text, textBytes));
SkAssertResult(font.textToGlyphs(utf8text, textBytes, SkTextEncoding::kUTF8, buffer.glyphs,
glyphCount) == glyphCount);
font.getPos(buffer.glyphs, glyphCount, buffer.positions, point);
- if (buffer.utf8text) {
- memcpy(buffer.utf8text, utf8text, textBytes);
- }
-
if (buffer.clusters) {
const char* txtPtr = utf8text;
for (int i = 0; i < glyphCount; ++i) {
@@ -76,7 +73,7 @@
SkASSERT(txtPtr <= utf8text + textBytes);
}
}
-
+ handler->commitRun();
handler->commitLine();
return point + SkVector::Make(0, metrics.fDescent + metrics.fLeading);