浏览代码

Allocate text blob positions in paragraph.

/main
Yuncong Zhang 5 年前
当前提交
699aded1
共有 1 个文件被更改,包括 10 次插入7 次删除
  1. 17
      Runtime/ui/txt/paragraph.cs

17
Runtime/ui/txt/paragraph.cs


List<float> _lineWidths = new List<float>();
// float[] _lineBaseLines;
GlyphLine[] _glyphLines;
GlyphPosition[] glyphPositions;
PaintRecord[] _paintRecords;
CodeUnitRun[] _codeUnitRuns;
float[] _lineHeights;
float[] _textBlobPositions;
float[] _lineHeights;
GlyphPosition[] glyphPositions;
PaintRecord[] _paintRecords;
CodeUnitRun[] _codeUnitRuns;
int _paintRecordsCount;
int _codeUnitRunsCount;
bool _didExceedMaxLines;

int ellipsizedLength = this._text.Length + (this._paragraphStyle.ellipsis?.Length ?? 0);
// All text blobs share a single position buffer, which is big enough taking ellipsis into consideration
builder.allocPos(ellipsizedLength);
if (this._textBlobPositions == null || this._textBlobPositions.Length < ellipsizedLength) {
this._textBlobPositions = new float[ellipsizedLength];
}
builder.setPositions(this._textBlobPositions);
// this._glyphLines and this._codeUnitRuns will refer to this array for glyph positions
if (this.glyphPositions == null || this.glyphPositions.Length < ellipsizedLength) {
this.glyphPositions = new GlyphPosition[ellipsizedLength];

runXOffset += advance;
// Create code unit run
CodeUnitRun codeUnitRun = new CodeUnitRun(
this._codeUnitRuns[this._codeUnitRunsCount++] = new CodeUnitRun(
this._codeUnitRuns[this._codeUnitRunsCount++] = codeUnitRun;
lineStyleRunIndex++;
}

正在加载...
取消
保存