paintParagraph method

void paintParagraph(
  1. Canvas canvas,
  2. Offset lineOrigin, {
  3. ColorAdaptation adapt = ColorAdaptation.none,
})

Paints the shared paragraph; a non-identity adapt paints a copy with re-mapped colors and identical line layout.

Implementation

void paintParagraph(
  Canvas canvas,
  Offset lineOrigin, {
  ColorAdaptation adapt = ColorAdaptation.none,
}) {
  if (emptyCaretX == null) {
    // Placement belongs to the canvas transform. Keep the retained paragraph
    // at its local origin instead of changing glyph draw coordinates on every
    // move (including fractional world positions and camera translations).
    final origin = lineOrigin - Offset(0, top);
    canvas.save();
    try {
      canvas.translate(origin.dx, origin.dy);
      _paragraphFor(adapt).paint(canvas, Offset.zero);
    } finally {
      canvas.restore();
    }
  }
}