|
|
|
|
|
|
get { return this._didExceedMaxLines; } |
|
|
|
} |
|
|
|
|
|
|
|
static List<Paragraph> _paragraphs = new List<Paragraph>(); |
|
|
|
static List<Paragraph> _paragraphPool = new List<Paragraph>(); |
|
|
|
if (_paragraphs.isEmpty()) { |
|
|
|
if (_paragraphPool.isEmpty()) { |
|
|
|
Paragraph ret = _paragraphs.last(); |
|
|
|
_paragraphs.RemoveAt(_paragraphs.Count - 1); |
|
|
|
Paragraph ret = _paragraphPool.last(); |
|
|
|
_paragraphPool.RemoveAt(_paragraphPool.Count - 1); |
|
|
|
_paragraphs.Add(paragraph); |
|
|
|
_paragraphPool.Add(paragraph); |
|
|
|
readonly Paint _textPaint = new Paint { |
|
|
|
filterMode = FilterMode.Bilinear |
|
|
|
}; |
|
|
|
|
|
|
|
public void paint(Canvas canvas, Offset offset) { |
|
|
|
for (int i = 0; i < this._paintRecordsCount; i++) { |
|
|
|
var paintRecord = this._paintRecords[i]; |
|
|
|
|
|
|
for (int i = 0; i < this._paintRecordsCount; i++) { |
|
|
|
var paintRecord = this._paintRecords[i]; |
|
|
|
var paint = new Paint { |
|
|
|
filterMode = FilterMode.Bilinear, |
|
|
|
color = paintRecord.style.color |
|
|
|
}; |
|
|
|
canvas.drawTextBlob(paintRecord.text, paintRecord.shiftedOffset(offset), paint); |
|
|
|
this._textPaint.color = paintRecord.style.color; |
|
|
|
canvas.drawTextBlob(paintRecord.text, paintRecord.shiftedOffset(offset), this._textPaint); |
|
|
|
this.paintDecorations(canvas, paintRecord, offset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
runIndex++; |
|
|
|
} |
|
|
|
|
|
|
|
this._maxIntrinsicWidth = Mathf.Max(lineBlockWidth, this._maxIntrinsicWidth); |
|
|
|
|
|
|
|
return countRuns; |
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var paint = new Paint(); |
|
|
|
paint.color = record.style.color; |
|
|
|
this._textPaint.color = record.style.color; |
|
|
|
paint.color = record.style.decorationColor; |
|
|
|
this._textPaint.color = record.style.decorationColor; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
paint.style = PaintingStyle.stroke; |
|
|
|
paint.strokeWidth = underLineThickness; |
|
|
|
this._textPaint.style = PaintingStyle.stroke; |
|
|
|
this._textPaint.strokeWidth = underLineThickness; |
|
|
|
var recordOffset = record.shiftedOffset(baseOffset); |
|
|
|
var x = recordOffset.dx; |
|
|
|
var y = recordOffset.dy; |
|
|
|
|
|
|
if (decoration != null && decoration.contains(TextDecoration.underline)) { |
|
|
|
// underline
|
|
|
|
yOffset += metrics.underlinePosition ?? underLineThickness; |
|
|
|
canvas.drawLine(new Offset(x, y + yOffset), new Offset(x + width, y + yOffset), paint); |
|
|
|
canvas.drawLine(new Offset(x, y + yOffset), new Offset(x + width, y + yOffset), this._textPaint); |
|
|
|
canvas.drawLine(new Offset(x, y + yOffset), new Offset(x + width, y + yOffset), paint); |
|
|
|
canvas.drawLine(new Offset(x, y + yOffset), new Offset(x + width, y + yOffset), this._textPaint); |
|
|
|
yOffset = yOffsetOriginal; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
canvas.drawLine(new Offset(x, y + yOffset), new Offset(x + width, y + yOffset), paint); |
|
|
|
canvas.drawLine(new Offset(x, y + yOffset), new Offset(x + width, y + yOffset), this._textPaint); |
|
|
|
|
|
|
|
this._textPaint.style = PaintingStyle.fill; |
|
|
|
this._textPaint.strokeWidth = 0; |
|
|
|
} |
|
|
|
|
|
|
|
void paintBackground(Canvas canvas, PaintRecord record, Offset baseOffset) { |
|
|
|