Remove the canvas save/restore calls in Paragraph::Paint (#4822)

This is a workaround for https://github.com/flutter/flutter/issues/15702

Skia was not drawing the paragraph's text blobs in some cases when a
save/restore sequence is done around the canvas->translate call.  The
problem does not occur if an offsetting call to translate is made instead
of the save/restore.  Will need to work with Skia to find the root cause.
This commit is contained in:
Jason Simmons 2018-03-20 11:30:00 -07:00 committed by GitHub
parent 6280adbfb1
commit c9da0000e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -773,7 +773,6 @@ void Paragraph::SetFontCollection(
// The x,y coordinates will be the very top left corner of the rendered
// paragraph.
void Paragraph::Paint(SkCanvas* canvas, double x, double y) {
SkAutoCanvasRestore canvas_restore(canvas, true);
canvas->translate(x, y);
SkPaint paint;
for (const PaintRecord& record : records_) {
@ -782,6 +781,7 @@ void Paragraph::Paint(SkCanvas* canvas, double x, double y) {
canvas->drawTextBlob(record.text(), offset.x(), offset.y(), paint);
PaintDecorations(canvas, record);
}
canvas->translate(-x, -y);
}
void Paragraph::PaintDecorations(SkCanvas* canvas, const PaintRecord& record) {