OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkTextBox.h" | 8 #include "SkTextBox.h" |
9 #include "SkUtils.h" | 9 #include "SkUtils.h" |
10 | 10 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 void operator()(const char text[], size_t length, SkScalar x, SkScalar y, | 286 void operator()(const char text[], size_t length, SkScalar x, SkScalar y, |
287 const SkPaint& paint) override { | 287 const SkPaint& paint) override { |
288 SkPaint p(paint); | 288 SkPaint p(paint); |
289 p.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 289 p.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
290 const int count = paint.countText(text, length); | 290 const int count = paint.countText(text, length); |
291 paint.textToGlyphs(text, length, fBuilder.allocRun(p, count, x, y).glyph
s); | 291 paint.textToGlyphs(text, length, fBuilder.allocRun(p, count, x, y).glyph
s); |
292 } | 292 } |
293 }; | 293 }; |
294 | 294 |
295 SkTextBlob* SkTextBox::snapshotTextBlob(SkScalar* computedBottom) const { | 295 sk_sp<SkTextBlob> SkTextBox::snapshotTextBlob(SkScalar* computedBottom) const { |
296 TextBlobVisitor visitor; | 296 TextBlobVisitor visitor; |
297 SkScalar newB = this->visit(visitor, fText, fLen, *fPaint); | 297 SkScalar newB = this->visit(visitor, fText, fLen, *fPaint); |
298 if (computedBottom) { | 298 if (computedBottom) { |
299 *computedBottom = newB; | 299 *computedBottom = newB; |
300 } | 300 } |
301 return (SkTextBlob*)visitor.fBuilder.build(); | 301 return visitor.fBuilder.make(); |
302 } | 302 } |
OLD | NEW |