1 #if 0 // Disabled until updated to use current API.
2 // Copyright 2019 Google LLC.
3 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4 #include "tools/fiddle/examples.h"
5 // HASH=e9d4eb8ece521b1329e7433d4b243fdf
6 REG_FIDDLE(TextBlob_getIntercepts, 256, 143, false, 0) {
7 void draw(SkCanvas* canvas) {
10 SkPoint textPos = { 20, 110 };
12 SkTextBlobBuilder textBlobBuilder;
13 const SkTextBlobBuilder::RunBuffer& run =
14 textBlobBuilder.allocRun(font, len, textPos.fX, textPos.fY);
18 sk_sp<const SkTextBlob> blob = textBlobBuilder.make();
20 SkScalar bounds[] = { 116, 134 };
21 int count = blob->getIntercepts(bounds, nullptr);
22 std::vector<SkScalar> intervals;
23 intervals.resize(count);
24 (void) paint.getTextBlobIntercepts(blob.get(), bounds, &intervals.front());
25 canvas->drawTextBlob(blob.get(), 0, 0, paint);
26 paint.setColor(0xFFFF7777);
27 SkScalar x = textPos.fX;
28 for (int i = 0; i < count; i+= 2) {
29 canvas->drawRect({x, bounds[0], intervals[i], bounds[1]}, paint);
32 canvas->drawRect({intervals[count - 1], bounds[0], 180, bounds[1]}, paint);
35 #endif // Disabled until updated to use current API.