public void GetLinesShape(int startLine, float startCharX, int endLine, float endCharX,
bool clipped,
List<Rect> resultRects)
{
LineInfo line1 = _lines[startLine];
LineInfo line2 = _lines[endLine];
if (startLine == endLine)
{
Rect r = Rect.MinMaxRect(startCharX, line1.y, endCharX, line1.y + line1.height);
if (clipped)
resultRects.Add(ToolSet.Intersection(ref r, ref _contentRect));
else
resultRects.Add(r);
}
else if (startLine == endLine - 1)
{
Rect r = Rect.MinMaxRect(startCharX, line1.y, GUTTER_X + line1.width, line1.y + line1.height);
if (clipped)
resultRects.Add(ToolSet.Intersection(ref r, ref _contentRect));
else
resultRects.Add(r);
r = Rect.MinMaxRect(GUTTER_X, line1.y + line1.height, endCharX, line2.y + line2.height);
if (clipped)
resultRects.Add(ToolSet.Intersection(ref r, ref _contentRect));
else
resultRects.Add(r);
}
else
{
Rect r = Rect.MinMaxRect(startCharX, line1.y, GUTTER_X + line1.width, line1.y + line1.height);
if (clipped)
resultRects.Add(ToolSet.Intersection(ref r, ref _contentRect));
else
resultRects.Add(r);
for (int i = startLine + 1; i < endLine; i++)
{
LineInfo line = _lines[i];
r = Rect.MinMaxRect(GUTTER_X, r.yMax, GUTTER_X + line.width, line.y + line.height);
if (clipped)
resultRects.Add(ToolSet.Intersection(ref r, ref _contentRect));
else
resultRects.Add(r);
}
r = Rect.MinMaxRect(GUTTER_X, r.yMax, endCharX, line2.y + line2.height);
if (clipped)
resultRects.Add(ToolSet.Intersection(ref r, ref _contentRect));
else
resultRects.Add(r);
}
}