Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: tools/SkShaper_harfbuzz.cpp

Issue 2084533004: SkTextBlob: Begin implementing Extended TextBlob API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/TextBlobTest.cpp ('k') | tools/using_skia_and_harfbuzz.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/SkShaper_harfbuzz.cpp
diff --git a/tools/SkShaper_harfbuzz.cpp b/tools/SkShaper_harfbuzz.cpp
index 29dd1b00f59775860edec3aa1de4d22616638f96..2c4d21180dfe9f38139e659394519a61bb2fc038 100644
--- a/tools/SkShaper_harfbuzz.cpp
+++ b/tools/SkShaper_harfbuzz.cpp
@@ -105,7 +105,9 @@ SkScalar SkShaper::shape(SkTextBlobBuilder* builder,
hb_glyph_info_t* info = hb_buffer_get_glyph_infos(buffer, NULL);
hb_glyph_position_t* pos =
hb_buffer_get_glyph_positions(buffer, NULL);
- auto runBuffer = builder->allocRunPos(paint, len);
+ auto runBuffer = builder->allocRunTextPos(
+ paint, SkToInt(len), SkToInt(textBytes), SkString());
+ memcpy(runBuffer.utf8text, utf8text, textBytes);
double x = point.x();
double y = point.y();
@@ -115,12 +117,14 @@ SkScalar SkShaper::shape(SkTextBlobBuilder* builder,
for (unsigned i = 0; i < len; i++) {
runBuffer.glyphs[i] = info[i].codepoint;
+ runBuffer.clusters[i] = info[i].cluster;
reinterpret_cast<SkPoint*>(runBuffer.pos)[i] =
SkPoint::Make(SkDoubleToScalar(x + pos[i].x_offset * textSizeX),
SkDoubleToScalar(y - pos[i].y_offset * textSizeY));
x += pos[i].x_advance * textSizeX;
y += pos[i].y_advance * textSizeY;
}
+
hb_buffer_clear_contents(buffer);
return (SkScalar)x;
}
« no previous file with comments | « tests/TextBlobTest.cpp ('k') | tools/using_skia_and_harfbuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698