DiffEditorPlugin: Add SideBySideDiffOutput

Move generation of SideDiffData into static diffOutput()
method.

Change-Id: Ie38b3e09dd8222e0219fdfb345bc7cf4a39f6e21
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-09-27 15:48:33 +02:00
parent 0def7c83d4
commit 3877ced865
9 changed files with 226 additions and 188 deletions

View File

@@ -1310,4 +1310,17 @@ QList<FileData> DiffUtils::readPatch(const QString &patch, bool *ok,
return fileDataList;
}
int DiffUtils::interpolate(int x, int x1, int x2, int y1, int y2)
{
if (x1 == x2)
return x1;
if (x == x1)
return y1;
if (x == x2)
return y2;
const int numerator = (y2 - y1) * x + x2 * y1 - x1 * y2;
const int denominator = x2 - x1;
return qRound((double)numerator / denominator);
}
} // namespace DiffEditor