Skip to content

Commit d1ca672

Browse files
reed-at-googleSkia Commit-Bot
authored andcommitted
use SkFont for blob TightBounds
Bug: skia: Change-Id: I77febaf5ab15784f1600f2f885a88dc907ae8284 Reviewed-on: https://skia-review.googlesource.com/c/176180 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
1 parent 3ccaa88 commit d1ca672

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/core/SkTextBlob.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,21 +254,17 @@ SkTextBlobBuilder::~SkTextBlobBuilder() {
254254
}
255255

256256
SkRect SkTextBlobBuilder::TightRunBounds(const SkTextBlob::RunRecord& run) {
257+
const SkFont& font = run.font();
257258
SkRect bounds;
258-
SkPaint paint;
259-
run.font().LEGACY_applyToPaint(&paint);
260-
paint.setTextEncoding(kGlyphID_SkTextEncoding);
261259

262260
if (SkTextBlob::kDefault_Positioning == run.positioning()) {
263-
paint.measureText(run.glyphBuffer(), run.glyphCount() * sizeof(uint16_t), &bounds);
261+
font.measureText(run.glyphBuffer(), run.glyphCount() * sizeof(uint16_t),
262+
kGlyphID_SkTextEncoding, &bounds);
264263
return bounds.makeOffset(run.offset().x(), run.offset().y());
265264
}
266265

267266
SkAutoSTArray<16, SkRect> glyphBounds(run.glyphCount());
268-
paint.getTextWidths(run.glyphBuffer(),
269-
run.glyphCount() * sizeof(uint16_t),
270-
nullptr,
271-
glyphBounds.get());
267+
font.getBounds(run.glyphBuffer(), run.glyphCount(), glyphBounds.get(), nullptr);
272268

273269
SkASSERT(SkTextBlob::kFull_Positioning == run.positioning() ||
274270
SkTextBlob::kHorizontal_Positioning == run.positioning());

0 commit comments

Comments
 (0)