Commit d38a0db3 authored by Adam Barth's avatar Adam Barth

Merge pull request #2764 from abarth/use_draw_paragraph

Use Canvas#drawParagraph
parents ca8dbe90 c9d3217c
...@@ -22,7 +22,7 @@ void beginFrame(Duration timeStamp) { ...@@ -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) { ...@@ -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 { ...@@ -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 { ...@@ -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) { }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment