simplify how we call apply

Bug: skia:
Change-Id: I16dd773812a63da7e565f610fe7a243a88e482d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228575
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2019-07-20 20:14:56 -04:00 committed by Skia Commit-Bot
parent 056bdda97a
commit c9f0c593ed

View File

@ -252,21 +252,13 @@ protected:
int y = 0;
for (int looper = 0; looper < fLoopers.count(); looper++) {
if (0) {
paint.setLooper(fLoopers[looper]);
canvas->save();
canvas->translate(0, SkIntToScalar(y));
canvas->drawTextBlob(fBlob, 0, 0, paint);
canvas->restore();
} else {
auto b = fBlob;
fLoopers[looper]->apply(canvas, paint, [b, y](SkCanvas* c, const SkPaint& p) {
c->save();
c->translate(0, SkIntToScalar(y));
c->drawTextBlob(b, 0, 0, p);
c->restore();
});
}
SkTextBlob* b = fBlob.get();
canvas->save();
canvas->translate(0, SkIntToScalar(y));
fLoopers[looper]->apply(canvas, paint, [b](SkCanvas* c, const SkPaint& p) {
c->drawTextBlob(b, 0, 0, p);
});
canvas->restore();
y += SkScalarFloorToInt(bounds.height());
}
}