MCPcopy Create free account
hub / github.com/KDE/kdiff3 / draw

Method draw

src/difftextwindow.cpp:1327–1373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1325}
1326
1327void DiffTextWindow::draw(RLPainter& p, const QRect& invalidRect, const qint32 beginLine, const LineRef& endLine)
1328{
1329 if(!d->hasLineData()) return;
1330
1331 d->initColors();
1332 p.setPen(d->thisColor());
1333
1334 for(qint32 line = beginLine; line < endLine; ++line)
1335 {
1336 qint32 wrapLineOffset = 0;
1337 qint32 wrapLineLength = 0;
1338 const Diff3Line* d3l = nullptr;
1339 bool bWrapLine = false;
1340 if(d->m_bWordWrap)
1341 {
1342 const Diff3WrapLine& d3wl = d->getDiff3WrapLineVector()[line];
1343 wrapLineOffset = d3wl.wrapLineOffset;
1344 wrapLineLength = d3wl.wrapLineLength;
1345 d3l = d3wl.pD3L;
1346 bWrapLine = line > 0 && d->getDiff3WrapLineVector()[line - 1].pD3L == d3l;
1347 }
1348 else
1349 {
1350 d3l = (*d->diff3LineVector())[line];
1351 }
1352 std::shared_ptr<const DiffList> pFineDiff1;
1353 std::shared_ptr<const DiffList> pFineDiff2;
1354 ChangeFlags changed = NoChange;
1355 ChangeFlags changed2 = NoChange;
1356
1357 LineRef srcLineIdx;
1358 d3l->getLineInfo(getWindowIndex(), KDiff3App::isTripleDiff(), srcLineIdx, pFineDiff1, pFineDiff2, changed, changed2);
1359
1360 d->writeLine(
1361 p, // QPainter
1362 pFineDiff1,
1363 pFineDiff2,
1364 line, // Line on the screen
1365 changed,
1366 changed2,
1367 srcLineIdx,
1368 wrapLineOffset,
1369 wrapLineLength,
1370 bWrapLine,
1371 invalidRect);
1372 }
1373}
1374
1375QString DiffTextWindowData::getString(const LineType d3lIdx) const
1376{

Callers 2

writeLineMethod · 0.80
writeLineMethod · 0.80

Calls 7

hasLineDataMethod · 0.80
initColorsMethod · 0.80
setPenMethod · 0.80
thisColorMethod · 0.80
diff3LineVectorMethod · 0.80
getLineInfoMethod · 0.80
writeLineMethod · 0.45

Tested by

no test coverage detected