Use Canvas#drawParagraph
We'll eventually remove Paragraph#paint. Fixes #2694
This commit is contained in:
parent
50a249e3ec
commit
c9d3217c3b
@ -22,7 +22,7 @@ void beginFrame(Duration timeStamp) {
|
|||||||
final ui.PictureRecorder recorder = new ui.PictureRecorder();
|
final ui.PictureRecorder recorder = new ui.PictureRecorder();
|
||||||
final ui.Canvas canvas = new ui.Canvas(recorder, physicalBounds);
|
final ui.Canvas canvas = new ui.Canvas(recorder, physicalBounds);
|
||||||
canvas.scale(devicePixelRatio, devicePixelRatio);
|
canvas.scale(devicePixelRatio, devicePixelRatio);
|
||||||
paragraph.paint(canvas, new ui.Offset(
|
canvas.drawParagraph(paragraph, new ui.Offset(
|
||||||
(logicalSize.width - paragraph.maxIntrinsicWidth) / 2.0,
|
(logicalSize.width - paragraph.maxIntrinsicWidth) / 2.0,
|
||||||
(logicalSize.height - paragraph.height) / 2.0
|
(logicalSize.height - paragraph.height) / 2.0
|
||||||
));
|
));
|
||||||
|
@ -21,7 +21,7 @@ ui.Picture paint(ui.Rect paintBounds) {
|
|||||||
|
|
||||||
// The paint method of Pargraph draws the contents of the paragraph unto the
|
// The paint method of Pargraph draws the contents of the paragraph unto the
|
||||||
// given canvas.
|
// given canvas.
|
||||||
paragraph.paint(canvas, new ui.Offset(paragraph.maxWidth / -2.0, (paragraph.maxWidth / 2.0) - 125));
|
canvas.drawParagraph(paragraph, new ui.Offset(paragraph.maxWidth / -2.0, (paragraph.maxWidth / 2.0) - 125));
|
||||||
|
|
||||||
return recorder.endRecording();
|
return recorder.endRecording();
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ class TextPainter {
|
|||||||
/// Paints the text onto the given canvas at the given offset.
|
/// Paints the text onto the given canvas at the given offset.
|
||||||
void paint(Canvas canvas, Offset offset) {
|
void paint(Canvas canvas, Offset offset) {
|
||||||
assert(!_needsLayout && "Please call layout() before paint() to position the text before painting it." is String);
|
assert(!_needsLayout && "Please call layout() before paint() to position the text before painting it." is String);
|
||||||
_paragraph.paint(canvas, offset);
|
canvas.drawParagraph(_paragraph, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset _getOffsetFromUpstream(int offset, Rect caretPrototype) {
|
Offset _getOffsetFromUpstream(int offset, Rect caretPrototype) {
|
||||||
|
@ -113,7 +113,7 @@ class RenderErrorBox extends RenderBox {
|
|||||||
_paragraph.maxWidth = size.width;
|
_paragraph.maxWidth = size.width;
|
||||||
}
|
}
|
||||||
_paragraph.layout();
|
_paragraph.layout();
|
||||||
_paragraph.paint(context.canvas, offset);
|
context.canvas.drawParagraph(_paragraph, offset);
|
||||||
}
|
}
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user